add patches to queue
[linux-2.6.22.y-op-patches.git] / queue-2.6.22.y / aio-only-account-IO-wait-time-in-read_events-if-there-are-active-requests.patch
blob1e514abfb938e309d8c79ecca8f9d6151407f41b
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
23 --- a/fs/aio.c
24 +++ b/fs/aio.c
25 @@ -1161,7 +1161,12 @@ retry:
26 ret = 0;
27 if (to.timed_out) /* Only check after read evt */
28 break;
29 - io_schedule();
30 + /* Try to only show up in io wait if there are ops
31 + * in flight */
32 + if (ctx->reqs_active)
33 + io_schedule();
34 + else
35 + schedule();
36 if (signal_pending(tsk)) {
37 ret = -EINTR;
38 break;