From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kent Overstreet Subject: Re: [PATCH 14/25] aio: Make aio_read_evt() more efficient Date: Thu, 29 Nov 2012 11:31:54 -0800 Message-ID: <20121129193154.GI15094@google.com> References: <1354121029-1376-1-git-send-email-koverstreet@google.com> <1354121029-1376-15-git-send-email-koverstreet@google.com> <20121129003816.GJ18574@lenny.home.zabbo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, bcrl@kvack.org, jmoyer@redhat.com, axboe@kernel.dk, viro@zeniv.linux.org.uk To: Zach Brown Return-path: Content-Disposition: inline In-Reply-To: <20121129003816.GJ18574@lenny.home.zabbo.net> Sender: owner-linux-aio@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Nov 28, 2012 at 04:38:16PM -0800, Zach Brown wrote: > > We can't use cmpxchg() on the ring buffer's head pointer directly, since > > it's modded to nr_events and would be susceptible to ABA. So instead we > > maintain a shadow head that uses the full 32 bits, and cmpxchg() that > > and then updated the real head pointer. > > Time to update this comment to reflect the mutex instead of the shadow > head? :) Yeah :P > > + ev = kmap(page); > > + copy_ret = copy_to_user(event + ret, ev + pos, sizeof(*ev) * i); > > + kunmap(page); > > For lack of a better time: do we want to bring up the missing > flush_dcache_page() calls around the kernel mappings of ring pages that > are also mapped to user addresses? Well, it's mainly aio_complete() that needs to be doing flush_dcache_page()... technically io_getevents should be too, but only because it's updating the head pointer. Should probably do it now and not forget about it again, but I think it should be its own patch. > > prepare_to_wait_exclusive(&ctx->wait, &wait, > > TASK_INTERRUPTIBLE); > > > > + ret = aio_read_events(ctx, event + i, nr - i); > > + if (ret < 0) > > break; > > As mentioned offlist: we don't want to be blocking under > TASK_INTERRUPTIBLE. Is the plan to do a non-blocking check and pop > outside the wait loop to do a blocking copy? Argh. This thing is getting irritating. Gonna mull this over on irc more. -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: aart@kvack.org