lkml.org 
[lkml]   [2018]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 4/4] aio: allow direct aio poll comletions for keyed wakeups
On Tue, Aug 07, 2018 at 09:04:41AM -0700, Andrew Morton wrote:
> > Because it is faster obviously. I can update the comment.
>
> I meant the comment could explain why it's a trylock instead of a
> spin_lock().

We could something like this the patch below.

Al, do you want me to resend or can you just fold it in?

diff --git a/fs/aio.c b/fs/aio.c
index 5943098a87c6..84df2c2bf80b 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1684,7 +1684,8 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,

/*
* Try to complete the iocb inline if we can to avoid a costly
- * context switch.
+ * context switch. As the waitqueue lock nests inside the ctx
+ * lock we can only do that if we can get it without waiting.
*/
if (spin_trylock(&iocb->ki_ctx->ctx_lock)) {
list_del(&iocb->ki_list);

\
 
 \ /
  Last update: 2018-08-08 11:53    [W:0.093 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site