Commit e00ba3dae077f54cfd2af42e939a618caa7a3bca

Authored by Jeff Moyer
Committed by Linus Torvalds
1 parent e3c0ac04f9

aio: only account I/O wait time in read_events if there are active requests

On 2.6.24, top started showing 100% iowait on one CPU when a UML instance was
running (but completely idle).  The UML code sits in io_getevents waiting for
an event to be submitted and completed.

Fix this by checking ctx->reqs_active before scheduling to determine whether
or not we are waiting for I/O.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -1161,7 +1161,12 @@
1161 1161 ret = 0;
1162 1162 if (to.timed_out) /* Only check after read evt */
1163 1163 break;
1164   - io_schedule();
  1164 + /* Try to only show up in io wait if there are ops
  1165 + * in flight */
  1166 + if (ctx->reqs_active)
  1167 + io_schedule();
  1168 + else
  1169 + schedule();
1165 1170 if (signal_pending(tsk)) {
1166 1171 ret = -EINTR;
1167 1172 break;