[Devel] [PATCH rh7] fs/aio: show real number of aio events in fs.aio-nr sysctl

Kirill Tkhai ktkhai at virtuozzo.com
Fri May 20 06:38:05 PDT 2016



On 20.05.2016 16:30, Andrey Ryabinin wrote:
> fs.aio-nr accounts number of aio events requested by user via io_setup()
> syscall. The kernel usually creates more events than was requested.
> CRIU doesn't care about the number of requested events, it cares only
> about created events. So while restoring the process CRIU requests
> in io_setup() the number of actually created events. This leads
> to inconsistent value of fs.aio-nr after the restore.
> 
> Let's account in fs.aio-nr a number of created events, not requested.
> 
> https://jira.sw.ru/browse/PSBM-47209
> 
> Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

Acked-by: Kirill Tkhai <ktkhai at virtuozzo.com>

> ---
>  fs/aio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 29d02ab..19ebcd1 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -633,12 +633,12 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
>  
>  	/* limit the number of system wide aios */
>  	spin_lock(&ve->aio_nr_lock);
> -	if (ve->aio_nr + nr_events > ve->aio_max_nr ||
> -	    ve->aio_nr + nr_events < ve->aio_nr) {
> +	if (ve->aio_nr + ctx->nr_events > ve->aio_max_nr ||
> +	    ve->aio_nr + ctx->nr_events < ve->aio_nr) {
>  		spin_unlock(&ve->aio_nr_lock);
>  		goto out_cleanup;
>  	}
> -	ve->aio_nr += ctx->max_reqs;
> +	ve->aio_nr += ctx->nr_events;
>  	spin_unlock(&ve->aio_nr_lock);
>  
>  	/* now link into global list. */
> 


More information about the Devel mailing list