lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200826132330.GD15126@quack2.suse.cz>
Date:   Wed, 26 Aug 2020 15:23:30 +0200
From:   Jan Kara <jack@...e.cz>
To:     Xianting Tian <xianting_tian@....com>
Cc:     bcrl@...ck.org, viro@...iv.linux.org.uk, linux-aio@...ck.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] aio: use wait_for_completion_io() when waiting for
 completion of io

On Wed 05-08-20 09:35:51, Xianting Tian wrote:
> When waiting for the completion of io, we need account iowait time. As
> wait_for_completion() calls schedule_timeout(), which doesn't account
> iowait time. While wait_for_completion_io() calls io_schedule_timeout(),
> which will account iowait time.
> 
> So using wait_for_completion_io() instead of wait_for_completion()
> when waiting for completion of io before exit_aio and io_destroy.
> 
> Signed-off-by: Xianting Tian <xianting_tian@....com>

Thanks for the patch! It looks good to me but IMO this is just scratching
the surface.  E.g. for AIO we are mostly going to wait in read_events() by
wait_event_interruptible_hrtimeout() and *that* doesn't account as IO wait
either? Which is IMO far bigger misaccounting... The two case you fix seem
to be just rare cornercases so what they do isn't a big deal either way.

So I agree it may be worth it to properly account waiting for AIO but if
you want to do that, then please handle mainly the common cases in AIO
code.

								Honza

> ---
>  fs/aio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/aio.c b/fs/aio.c
> index 91e7cc4..498b8a0 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -892,7 +892,7 @@ void exit_aio(struct mm_struct *mm)
>  
>  	if (!atomic_sub_and_test(skipped, &wait.count)) {
>  		/* Wait until all IO for the context are done. */
> -		wait_for_completion(&wait.comp);
> +		wait_for_completion_io(&wait.comp);
>  	}
>  
>  	RCU_INIT_POINTER(mm->ioctx_table, NULL);
> @@ -1400,7 +1400,7 @@ static long read_events(struct kioctx *ctx, long min_nr, long nr,
>  		 * is destroyed.
>  		 */
>  		if (!ret)
> -			wait_for_completion(&wait.comp);
> +			wait_for_completion_io(&wait.comp);
>  
>  		return ret;
>  	}
> -- 
> 1.8.3.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ