v2.6.22.22-op2-rc1
[linux-2.6.22.y-op-patches.git] / review-2.6.22.y / aio-only-account-IO-wait-time-in-read_events-if-there-are-active-requests.patch
blob8028aaa0fe77ff9c54dd5e5768698edd77a88eed
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>
20 Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
23 diff --git a/fs/aio.c b/fs/aio.c
24 index f12db41..9dec7d2 100644
25 --- a/fs/aio.c
26 +++ b/fs/aio.c
27 @@ -1161,7 +1161,12 @@ retry:
28 ret = 0;
29 if (to.timed_out) /* Only check after read evt */
30 break;
31 - io_schedule();
32 + /* Try to only show up in io wait if there are ops
33 + * in flight */
34 + if (ctx->reqs_active)
35 + io_schedule();
36 + else
37 + schedule();
38 if (signal_pending(tsk)) {
39 ret = -EINTR;
40 break;