All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Overstreet <koverstreet@google.com>
To: Zach Brown <zab@redhat.com>
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
Subject: Re: [PATCH 14/25] aio: Make aio_read_evt() more efficient
Date: Thu, 29 Nov 2012 11:31:54 -0800	[thread overview]
Message-ID: <20121129193154.GI15094@google.com> (raw)
In-Reply-To: <20121129003816.GJ18574@lenny.home.zabbo.net>

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: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

WARNING: multiple messages have this Message-ID (diff)
From: Kent Overstreet <koverstreet@google.com>
To: Zach Brown <zab@redhat.com>
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
Subject: Re: [PATCH 14/25] aio: Make aio_read_evt() more efficient
Date: Thu, 29 Nov 2012 11:31:54 -0800	[thread overview]
Message-ID: <20121129193154.GI15094@google.com> (raw)
In-Reply-To: <20121129003816.GJ18574@lenny.home.zabbo.net>

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.

  reply	other threads:[~2012-11-29 19:31 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28 16:43 [PATCH 00/25] AIO performance improvements/cleanups Kent Overstreet
2012-11-28 16:43 ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 01/25] mm: remove old aio use_mm() comment Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 02/25] aio: remove dead code from aio.h Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 03/25] gadget: remove only user of aio retry Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 04/25] aio: remove retry-based AIO Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 05/25] char: add aio_{read,write} to /dev/{null,zero} Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 06/25] aio: Kill return value of aio_complete() Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 07/25] aio: kiocb_cancel() Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-29  0:07   ` Zach Brown
2012-11-29  0:58     ` Kent Overstreet
2012-11-29  0:58       ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 08/25] aio: Move private stuff out of aio.h Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 09/25] aio: dprintk() -> pr_debug() Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 10/25] aio: do fget() after aio_get_req() Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 11/25] aio: Make aio_put_req() lockless Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 12/25] aio: Refcounting cleanup Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-29  0:17   ` Zach Brown
2012-11-29  0:17     ` Zach Brown
2012-11-29  1:12     ` Kent Overstreet
2012-11-29  1:12       ` Kent Overstreet
2012-11-29  0:46   ` Benjamin LaHaise
2012-11-29  0:46     ` Benjamin LaHaise
2012-11-29  1:38     ` Kent Overstreet
2012-11-29  1:38       ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 13/25] aio: Convert read_events() to hrtimers Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-29  0:24   ` Zach Brown
2012-11-29  0:24     ` Zach Brown
2012-11-29  1:05     ` Kent Overstreet
2012-11-29  1:05       ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 14/25] aio: Make aio_read_evt() more efficient Kent Overstreet
2012-11-29  0:38   ` Zach Brown
2012-11-29  0:38     ` Zach Brown
2012-11-29 19:31     ` Kent Overstreet [this message]
2012-11-29 19:31       ` Kent Overstreet
2012-11-30  0:20     ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 15/25] aio: Use cancellation list lazily Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 16/25] aio: Change reqs_active to include unreaped completions Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 17/25] aio: Kill batch allocation Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 18/25] aio: Kill struct aio_ring_info Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 19/25] aio: Give shared kioctx fields their own cachelines Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 20/25] aio: reqs_active -> reqs_available Kent Overstreet
2012-11-28 16:43 ` [PATCH 21/25] aio: percpu reqs_available Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-28 16:43 ` [PATCH 22/25] Generic dynamic per cpu refcounting Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-29 18:45   ` Andi Kleen
2012-11-29 18:45     ` Andi Kleen
2012-11-29 18:57     ` Kent Overstreet
2012-11-29 18:57       ` Kent Overstreet
2012-11-29 18:59       ` Andi Kleen
2012-11-29 19:12         ` Kent Overstreet
2012-11-29 19:12           ` Kent Overstreet
2012-11-29 19:20           ` Andi Kleen
2012-11-29 19:20             ` Andi Kleen
2012-11-29 19:29             ` Kent Overstreet
2012-11-29 19:29               ` Kent Overstreet
2012-11-29 19:34               ` Benjamin LaHaise
2012-11-29 19:34                 ` Benjamin LaHaise
2012-11-29 20:22                 ` Kent Overstreet
2012-11-29 20:42                   ` Andi Kleen
2012-11-29 20:45                     ` Kent Overstreet
2012-11-29 20:45                       ` Kent Overstreet
2012-11-29 20:54                       ` Andi Kleen
2012-11-29 20:54                         ` Andi Kleen
2012-11-29 20:59                         ` Kent Overstreet
2012-11-29 21:57                           ` Jamie Lokier
2012-11-29 21:57                             ` Jamie Lokier
2012-11-28 16:43 ` [PATCH 23/25] aio: Percpu ioctx refcount Kent Overstreet
2012-11-28 16:43 ` [PATCH 24/25] aio: use xchg() instead of completion_lock Kent Overstreet
2012-11-28 16:43 ` [PATCH 25/25] aio: Don't include aio.h in sched.h Kent Overstreet
2012-11-28 16:43   ` Kent Overstreet
2012-11-29  0:03 ` [PATCH 00/25] AIO performance improvements/cleanups Zach Brown
2012-11-29  0:03   ` Zach Brown
2012-11-29 19:01   ` Kent Overstreet
2012-11-29 19:01     ` Kent Overstreet
  -- strict thread matches above, loose matches on Subject: below --
2012-11-28  3:19 Kent Overstreet
2012-11-28  3:19 ` [PATCH 14/25] aio: Make aio_read_evt() more efficient Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121129193154.GI15094@google.com \
    --to=koverstreet@google.com \
    --cc=axboe@kernel.dk \
    --cc=bcrl@kvack.org \
    --cc=jmoyer@redhat.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.