1 From e00ba3dae077f54cfd2af42e939a618caa7a3bca Mon Sep 17 00:00:00 2001
2 From: Jeff Moyer <jmoyer@redhat.com>
3 Date: Tue, 4 Dec 2007 23:45:02 -0800
4 Subject: [PATCH] aio: only account I/O wait time in read_events if there are active requests
6 On 2.6.24, top started showing 100% iowait on one CPU when a UML instance was
7 running (but completely idle). The UML code sits in io_getevents waiting for
8 an event to be submitted and completed.
10 Fix this by checking ctx->reqs_active before scheduling to determine whether
11 or not we are waiting for I/O.
13 Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
14 Cc: Zach Brown <zach.brown@oracle.com>
15 Cc: Miklos Szeredi <miklos@szeredi.hu>
16 Cc: Jeff Dike <jdike@addtoit.com>
17 Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
18 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
19 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21 diff --git a/fs/aio.c b/fs/aio.c
22 index f12db41..9dec7d2 100644
25 @@ -1161,7 +1161,12 @@ retry:
27 if (to.timed_out) /* Only check after read evt */
30 + /* Try to only show up in io wait if there are ops
32 + if (ctx->reqs_active)
36 if (signal_pending(tsk)) {