[Devel] [PATCH] aio: Multiply passed nr_events in io_setup()

Andrey Ryabinin aryabinin at virtuozzo.com
Fri May 20 06:28:51 PDT 2016



On 05/20/2016 03:04 PM, Kirill Tkhai wrote:
> CRIU supports AIO in kernel versions >= 3.19.
> It expects the logic, which was introduced in
> kernel commit e1bdd5f27a5b, when it became
> to multiply the passed nr_events twice.
> Vz7 kernel doesn't do that, and this lead
> to wrong calculation of lenght of AIO ring in CRIU.
> 
> This is a port of small part of commit e1bdd5f27a5b,
> to make CRIU works on Virtuozzo 7 kernel.
> 
> https://jira.sw.ru/browse/PSBM-47075
> 

Also needed for https://jira.sw.ru/browse/PSBM-47209

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

Acked-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

> ---
>  fs/aio.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 29d02ab..ee72178 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -596,6 +596,9 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
>  	struct ve_struct *ve = get_exec_env();
>  	int err = -ENOMEM;
>  
> +	/* Kernel since e1bdd5f27a5b do this, and criu is tuned on that */
> +	nr_events *= 2;
> +
>  	/* Prevent overflows */
>  	if ((nr_events > (0x10000000U / sizeof(struct io_event))) ||
>  	    (nr_events > (0x10000000U / sizeof(struct kiocb)))) {
> 


More information about the Devel mailing list