Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Xianting Tian <xianting_tian@126.com>
To: bcrl@kvack.org, viro@zeniv.linux.org.uk
Cc: linux-aio@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] aio: use wait_for_completion_io() when waiting for completion of io
Date: Wed,  5 Aug 2020 09:35:51 -0400	[thread overview]
Message-ID: <1596634551-27526-1-git-send-email-xianting_tian@126.com> (raw)

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@126.com>
---
 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


             reply	other threads:[~2020-08-05 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 13:35 Xianting Tian [this message]
2020-08-26 13:23 ` Jan Kara
     [not found]   ` <26ae9330.63f4.1742b70dd88.Coremail.xianting_tian@126.com>
2020-08-27  7:55     ` Jan Kara
     [not found]       ` <5ef5b380.877b.1742f087437.Coremail.xianting_tian@126.com>
2020-08-27  8:46         ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596634551-27526-1-git-send-email-xianting_tian@126.com \
    --to=xianting_tian@126.com \
    --cc=bcrl@kvack.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH] aio: use wait_for_completion_io() when waiting for completion of io' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).