summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-11-06 20:44:36 +0800
committerBenjamin LaHaise <bcrl@kvack.org>2014-12-13 17:50:20 -0500
commit5f785de588735306ec4d7c875caf9d28481c8b21 (patch)
tree7f405dcbe7e4b53d554ee6e4040a331a505dcd92 /fs
parente4a0d3e720e7e508749c1439b5ba3aff56c92976 (diff)
downloadlinux-5f785de588735306ec4d7c875caf9d28481c8b21.tar.bz2
aio: Skip timer for io_getevents if timeout=0
In this case, it is basically a polling. Let's not involve timer at all because that would hurt performance for application event loops. In an arbitrary test I've done, io_getevents syscall elapsed time reduces from 50000+ nanoseconds to a few hundereds. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/aio.c b/fs/aio.c
index bfab55607a4d..1b7893ecc296 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1253,8 +1253,12 @@ static long read_events(struct kioctx *ctx, long min_nr, long nr,
* the ringbuffer empty. So in practice we should be ok, but it's
* something to be aware of when touching this code.
*/
- wait_event_interruptible_hrtimeout(ctx->wait,
- aio_read_events(ctx, min_nr, nr, event, &ret), until);
+ if (until.tv64 == 0)
+ aio_read_events(ctx, min_nr, nr, event, &ret);
+ else
+ wait_event_interruptible_hrtimeout(ctx->wait,
+ aio_read_events(ctx, min_nr, nr, event, &ret),
+ until);
if (!ret && signal_pending(current))
ret = -EINTR;