[PATCH 01/25] mm: remove old aio use_mm() comment

2012-11-28 Thread Kent Overstreet
From: Zach Brown use_mm() is used in more places than just aio. There's no need to mention callers when describing the function. Signed-off-by: Zach Brown Signed-off-by: Kent Overstreet --- mm/mmu_context.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/mmu_context.c

[PATCH 08/25] aio: Move private stuff out of aio.h

2012-11-28 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/usb/gadget/inode.c | 1 + fs/aio.c | 61 ++ include/linux/aio.h| 61 -- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a

[PATCH 20/25] aio: reqs_active -> reqs_available

2012-11-28 Thread Kent Overstreet
just allocate and free slots, and we know how to write per cpu allocators. So as prep work for that, we convert reqs_active to reqs_available. Signed-off-by: Kent Overstreet --- fs/aio.c | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/fs/aio.c

[PATCH 23/25] aio: Percpu ioctx refcount

2012-11-28 Thread Kent Overstreet
This just converts the ioctx refcount to the new generic dynamic percpu refcount code. Signed-off-by: Kent Overstreet --- fs/aio.c | 30 +- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 94218b7..0975675 100644 --- a/fs

[PATCH 24/25] aio: use xchg() instead of completion_lock

2012-11-28 Thread Kent Overstreet
to be pulling it out from under us as we're using it. So, we use an old trick to get rid of this second forced cache miss - make the data the lock protects be the lock itself, so we grab them both at once. Signed-off-by: Kent Overstreet --- fs/aio.c | 24 +--- 1 file chan

[PATCH 14/25] aio: Make aio_read_evt() more efficient

2012-11-28 Thread Kent Overstreet
. This also fixes a bug where if copying the event to userspace failed, we'd lose the event. Signed-off-by: Kent Overstreet --- fs/aio.c | 173 +-- 1 file changed, 80 insertions(+), 93 deletions(-) diff --git a/fs/aio.c b/fs/aio

[PATCH 25/25] aio: Don't include aio.h in sched.h

2012-11-28 Thread Kent Overstreet
Yay faster kernel compiles Signed-off-by: Kent Overstreet --- arch/s390/hypfs/inode.c | 1 + block/scsi_ioctl.c | 1 + drivers/char/mem.c | 1 + drivers/infiniband/hw/ipath/ipath_file_ops.c | 1 + drivers/infiniband/hw/qib

[PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-28 Thread Kent Overstreet
I expect this'll be good enough in practice. Signed-off-by: Kent Overstreet --- include/linux/percpu-refcount.h | 29 +++ lib/Makefile| 2 +- lib/percpu-refcount.c | 164 3 files changed, 194 insertions(+), 1 d

[PATCH 21/25] aio: percpu reqs_available

2012-11-28 Thread Kent Overstreet
e, it was being rounded up to the next page before so this doesn't change the actual semantics. Signed-off-by: Kent Overstreet --- fs/aio.c | 97 1 file changed, 85 insertions(+), 12 deletions(-) diff --git a/fs/aio.c b/fs

[PATCH 18/25] aio: Kill struct aio_ring_info

2012-11-28 Thread Kent Overstreet
eordering a bit clearer. Signed-off-by: Kent Overstreet --- fs/aio.c | 142 ++- 1 file changed, 68 insertions(+), 74 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index f2d616e..1ff4d3b 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -58,18 +58,6 @@

[PATCH 04/25] aio: remove retry-based AIO

2012-11-28 Thread Kent Overstreet
removal of the locking around the unused run list in the submission path. This has only been compiled. Signed-off-by: Kent Overstreet --- fs/aio.c | 348 -- fs/ocfs2/dlmglue.c| 2 +- fs/read_write.c | 34 + include/linux

[PATCH 13/25] aio: Convert read_events() to hrtimers

2012-11-28 Thread Kent Overstreet
Converting read_events() to prepare_to_wait_exclusive() and hrtimers simplifies it quite a bit. Signed-off-by: Kent Overstreet --- fs/aio.c | 78 +--- 1 file changed, 21 insertions(+), 57 deletions(-) diff --git a/fs/aio.c b/fs/aio.c

[PATCH 12/25] aio: Refcounting cleanup

2012-11-28 Thread Kent Overstreet
other syscalls may still be submitting kiocbs! Now, we cancel and wait for outstanding kiocbs in free_ioctx(), after kioctx->users has dropped to 0 and we know no more iocbs could be submitted. Signed-off-by: Kent Overstreet --- fs/aio.c | 236 ++--

[PATCH 19/25] aio: Give shared kioctx fields their own cachelines

2012-11-28 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- fs/aio.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 1ff4d3b..7dee3aa 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -67,13 +67,6 @@ struct kioctx { unsigned long user_id

[PATCH 17/25] aio: Kill batch allocation

2012-11-28 Thread Kent Overstreet
cachelines, so that means we can just rip this code out. Signed-off-by: Kent Overstreet --- fs/aio.c| 117 +++- include/linux/aio.h | 1 - 2 files changed, 15 insertions(+), 103 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 0d5062

[PATCH 16/25] aio: Change reqs_active to include unreaped completions

2012-11-28 Thread Kent Overstreet
But - we can improve this quite a bit if we just change reqs_active to mean "number of outstanding requests and unreaped completions" - that means kiocb allocation doesn't have to look at the ringbuffer, which is a fairly significant win. Signed-off-by: Kent Overstreet

[PATCH 15/25] aio: Use cancellation list lazily

2012-11-28 Thread Kent Overstreet
Cancelling kiocbs requires adding them to a per kioctx linked list, which is one of the few things we need to take the kioctx lock for in the fast path. But most kiocbs can't be cancelled - so if we just do this lazily, we can avoid quite a bit of locking overhead. Signed-off-by: Kent Overs

[PATCH 11/25] aio: Make aio_put_req() lockless

2012-11-28 Thread Kent Overstreet
tive list. This occurs in two places: kiocb_batch_free(), which is going away in a later patch, and the error path in io_submit_one. Signed-off-by: Kent Overstreet --- fs/aio.c| 85 + include/linux/aio.h | 4 +-- 2 files changed, 35 in

[PATCH 10/25] aio: do fget() after aio_get_req()

2012-11-28 Thread Kent Overstreet
aio_get_req() will fail if we have the maximum number of requests outstanding, which depending on the application may not be uncommon. So avoid doing an unnecessary fget(). Signed-off-by: Kent Overstreet --- fs/aio.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions

[PATCH 09/25] aio: dprintk() -> pr_debug()

2012-11-28 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- fs/aio.c | 57 - 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 4dcc02f..0ed14e8 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -8,6 +8,8 @@ * * See ../COPYING

[PATCH 00/25] AIO performance improvements/cleanups

2012-11-28 Thread Kent Overstreet
rformance issues to speak of in the aio code. Real world benchmarks are still lacking, I've just been focused on profiles. I'll try and post some actual benchmarks/profiles later. The patch series is on top of v3.7-rc7, git repo is at http://evilpiepirate.org/git/linux-bcache.git aio-up

[PATCH 05/25] char: add aio_{read,write} to /dev/{null,zero}

2012-11-28 Thread Kent Overstreet
From: Zach Brown These are handy for measuring the cost of the aio infrastructure with operations that do very little and complete immediately. Signed-off-by: Zach Brown Signed-off-by: Kent Overstreet --- drivers/char/mem.c | 35 +++ 1 file changed, 35

[PATCH 07/25] aio: kiocb_cancel()

2012-11-28 Thread Kent Overstreet
Minor refactoring, to get rid of some duplicated code Signed-off-by: Kent Overstreet --- fs/aio.c | 72 +++- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 91879d4..a993234 100644 --- a/fs

[PATCH 06/25] aio: Kill return value of aio_complete()

2012-11-28 Thread Kent Overstreet
Nothing used the return value, and it probably wasn't possible to use it safely for the locked versions (aio_complete(), aio_put_req()). Just kill it. Acked-by: Zach Brown Signed-off-by: Kent Overstreet --- fs/aio.c| 19 +++ include/linux/aio.h | 8 --

[PATCH 03/25] gadget: remove only user of aio retry

2012-11-28 Thread Kent Overstreet
call. It only used the AIO retry facility to get the submitter's mm context for copying the result of a read back to user space. This is easy to implement with use_mm() and a work struct, much like kvm does with async_pf_execute() for get_user_pages(). Signed-off-by: Zach Brown Signed-of

[PATCH 02/25] aio: remove dead code from aio.h

2012-11-28 Thread Kent Overstreet
From: Zach Brown Signed-off-by: Zach Brown Signed-off-by: Kent Overstreet --- include/linux/aio.h | 24 1 file changed, 24 deletions(-) diff --git a/include/linux/aio.h b/include/linux/aio.h index 31ff6db..b46a09f 100644 --- a/include/linux/aio.h +++ b/include/linux

Re: [PATCH 07/25] aio: kiocb_cancel()

2012-11-28 Thread Kent Overstreet
On Wed, Nov 28, 2012 at 04:07:53PM -0800, Zach Brown wrote: > On Wed, Nov 28, 2012 at 08:43:31AM -0800, Kent Overstreet wrote: > > Minor refactoring, to get rid of some duplicated code > > A minor nit: > > > spin_lock_irq(&ctx->ctx_lock); > > -

Re: [PATCH 13/25] aio: Convert read_events() to hrtimers

2012-11-28 Thread Kent Overstreet
On Wed, Nov 28, 2012 at 04:24:36PM -0800, Zach Brown wrote: > > - int i = 0; > > + DEFINE_WAIT(wait); > > + struct hrtimer_sleeper t; > > + size_t i = 0; > > Changing i to size_t is kind of surprising. Is that on purpose? I doubt it matters due to limits on ringbuffer

Re: [PATCH 12/25] aio: Refcounting cleanup

2012-11-28 Thread Kent Overstreet
On Wed, Nov 28, 2012 at 04:17:59PM -0800, Zach Brown wrote: > > > struct kioctx { > > atomic_tusers; > > - int dead; > > + atomic_tdead; > > Do we want to be paranoid and atomic_set() that to 0 when the ioctx is > allocated? I suppose

Re: [PATCH 12/25] aio: Refcounting cleanup

2012-11-28 Thread Kent Overstreet
On Wed, Nov 28, 2012 at 07:46:31PM -0500, Benjamin LaHaise wrote: > Hi Kent, > > On Wed, Nov 28, 2012 at 08:43:36AM -0800, Kent Overstreet wrote: > > + * now it's safe to cancel any that need to be. > > + */ > > +static void free_ioctx(struct kioctx *ctx) >

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Kent Overstreet
On Thu, Nov 29, 2012 at 10:45:04AM -0800, Andi Kleen wrote: > Kent Overstreet writes: > > > This implements a refcount with similar semantics to > > atomic_get()/atomic_dec_and_test(), that starts out as just an atomic_t > > but dynamically switches to per cpu refc

Re: [PATCH 00/25] AIO performance improvements/cleanups

2012-11-29 Thread Kent Overstreet
On Wed, Nov 28, 2012 at 04:03:03PM -0800, Zach Brown wrote: > On Wed, Nov 28, 2012 at 08:43:24AM -0800, Kent Overstreet wrote: > > Bunch of performance improvements and cleanups Zach Brown and I have > > been working on. The code should be pretty solid at this point, though > &g

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Kent Overstreet
On Thu, Nov 29, 2012 at 07:59:53PM +0100, Andi Kleen wrote: > On Thu, Nov 29, 2012 at 10:57:20AM -0800, Kent Overstreet wrote: > > On Thu, Nov 29, 2012 at 10:45:04AM -0800, Andi Kleen wrote: > > > Kent Overstreet writes: > > > > > > > This implemen

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Kent Overstreet
On Thu, Nov 29, 2012 at 08:20:03PM +0100, Andi Kleen wrote: > > The trick is that we don't watch for the refcount hitting 0 until we're > > shutting down - so this only works if you keep track of your initial > > refcount. As long as we're not shutting down, we know the refcount can't > > hit 0 bec

Re: [PATCH 14/25] aio: Make aio_read_evt() more efficient

2012-11-29 Thread Kent Overstreet
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

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Kent Overstreet
On Thu, Nov 29, 2012 at 02:34:52PM -0500, Benjamin LaHaise wrote: > On Thu, Nov 29, 2012 at 11:29:25AM -0800, Kent Overstreet wrote: > > There's some kind of symmetry going on here, and if I'd been awake more > > in college I could probably say exactly why it works, but

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Kent Overstreet
On Thu, Nov 29, 2012 at 12:42:17PM -0800, Andi Kleen wrote: > Kent Overstreet writes: > > > On Thu, Nov 29, 2012 at 02:34:52PM -0500, Benjamin LaHaise wrote: > >> On Thu, Nov 29, 2012 at 11:29:25AM -0800, Kent Overstreet wrote: > >> > There's some kind of s

Re: [PATCH 22/25] Generic dynamic per cpu refcounting

2012-11-29 Thread Kent Overstreet
On Thu, Nov 29, 2012 at 09:54:47PM +0100, Andi Kleen wrote: > > > The regular atomic_t is limited in ways that you are not. > > > See my original mail. > > > > I don't follow, can you explain? > > For most cases the reference count is tied to some object, which are > naturally limited by memory s

Re: [PATCH 14/25] aio: Make aio_read_evt() more efficient

2012-11-29 Thread Kent Overstreet
sted on irc earlier: commit 913ff32bbd4de15a87b07a87ac196e978bc29e17 Author: Kent Overstreet Date: Thu Nov 29 14:12:40 2012 -0800 aio: Make aio_read_evt() more efficient Previously, aio_read_event() pulled a single completion off the ringbuffer at a time, locking and

[PATCH 25/33] aio: use xchg() instead of completion_lock

2013-03-21 Thread Kent Overstreet
to be pulling it out from under us as we're using it. So, we use an old trick to get rid of this second forced cache miss - make the data the lock protects be the lock itself, so we grab them both at once. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman

[PATCH 30/33] block, aio: batch completion for bios/kiocbs

2013-03-21 Thread Kent Overstreet
where rational] [a...@linux-foundation.org: fix warnings] [minc...@kernel.org: fix build error due to bio_endio_batch] [a...@linux-foundation.org: fix tracepoint in batch_complete()] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Be

[PATCH 31/33] virtio-blk: convert to batch completion

2013-03-21 Thread Kent Overstreet
Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al Viro Cc: Benjamin LaHaise Cc: Theodore Ts'o Signed-o

[PATCH 18/33] aio: kill batch allocation

2013-03-21 Thread Kent Overstreet
cachelines, so that means we can just rip this code out. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: A

[PATCH 32/33] mtip32xx: convert to batch completion

2013-03-21 Thread Kent Overstreet
() * mtip_handle_tfe()] Signed-off-by: Kent Overstreet Signed-off-by: Asai Thambi S P Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al

[PATCH 27/33] aio: kill ki_key

2013-03-21 Thread Kent Overstreet
ki_key wasn't actually used for anything previously - it was always 0. Drop it to trim struct kiocb a bit. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: S

[PATCH 26/33] aio: don't include aio.h in sched.h

2013-03-21 Thread Kent Overstreet
Faster kernel compiles by way of fewer unnecessary includes. [a...@linux-foundation.org: fix fallout] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani

[PATCH 23/33] generic dynamic per cpu refcounting

2013-03-21 Thread Kent Overstreet
But I expect this'll be good enough in practice. [a...@linux-foundation.org: fix build] [a...@linux-foundation.org: coding-style tweak] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe C

[PATCH 22/33] aio: percpu reqs_available

2013-03-21 Thread Kent Overstreet
vents wasn't being used as a hard limit before, it was being rounded up to the next page before so this doesn't change the actual semantics. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Je

[PATCH 21/33] aio: reqs_active -> reqs_available

2013-03-21 Thread Kent Overstreet
just allocate and free slots, and we know how to write per cpu allocators. So as prep work for that, we convert reqs_active to reqs_available. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens

[PATCH 05/33] char: add aio_{read,write} to /dev/{null,zero}

2013-03-21 Thread Kent Overstreet
From: Zach Brown These are handy for measuring the cost of the aio infrastructure with operations that do very little and complete immediately. Signed-off-by: Zach Brown Signed-off-by: Kent Overstreet Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty

[PATCH 10/33] aio: do fget() after aio_get_req()

2013-03-21 Thread Kent Overstreet
aio_get_req() will fail if we have the maximum number of requests outstanding, which depending on the application may not be uncommon. So avoid doing an unnecessary fget(). Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker

[PATCH 15/33] aio: use flush_dcache_page()

2013-03-21 Thread Kent Overstreet
Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al Viro Cc: Benjamin LaHaise Signed-off-by: Andrew Morton

[PATCH 19/33] aio: kill struct aio_ring_info

2013-03-21 Thread Kent Overstreet
eordering a bit clearer. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al Viro Cc: Benjamin LaHaise Cc: Theodore T

[PATCH 17/33] aio: change reqs_active to include unreaped completions

2013-03-21 Thread Kent Overstreet
Ouch. But - we can improve this quite a bit if we just change reqs_active to mean "number of outstanding requests and unreaped completions" - that means kiocb allocation doesn't have to look at the ringbuffer, which is a fairly significant win. Signed-off-by: Kent Overstreet Cc: Za

[PATCH 02/33] aio: remove dead code from aio.h

2013-03-21 Thread Kent Overstreet
From: Zach Brown Signed-off-by: Zach Brown Signed-off-by: Kent Overstreet Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al Viro Cc: Benjamin LaHaise Cc

[PATCH 16/33] aio: use cancellation list lazily

2013-03-21 Thread Kent Overstreet
instead of using a flag bit switch to using ki_cancel itself to indicate that a kiocb has been cancelled/completed. This lets us get rid of ki_flags entirely. [a...@linux-foundation.org: remove buggy BUG()] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman

[PATCH 14/33] aio: make aio_read_evt() more efficient, convert to hrtimers

2013-03-21 Thread Kent Overstreet
lose the event. Also convert it to wait_event_interruptible_hrtimeout(), which simplifies it quite a bit. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Man

[PATCH 13/33] wait: add wait_event_hrtimeout()

2013-03-21 Thread Kent Overstreet
behaviour arising from that too. I came to the conclusion that if other users end up actually needing the amount of time remaining, the sanest thing to do would be to create a version that uses absolute timeouts instead of relative. [a...@linux-foundation.org: fix description of `timeout' a

[PATCH 00/33] AIO cleanups/performance improvements

2013-03-21 Thread Kent Overstreet
us() * 4); + BUG_ON(!ctx->req_batch); + /* limit the number of system wide aios */ spin_lock(&aio_nr_lock); if (aio_nr + nr_events > aio_max_nr || Benjamin LaHaise (1): aio: fix kioctx not being freed after cancellation at exit time Kent Overstreet (27):

[PATCH 03/33] gadget: remove only user of aio retry

2013-03-21 Thread Kent Overstreet
call. It only used the AIO retry facility to get the submitter's mm context for copying the result of a read back to user space. This is easy to implement with use_mm() and a work struct, much like kvm does with async_pf_execute() for get_user_pages(). Signed-off-by: Zach Brown Signed-of

[PATCH 06/33] aio: kill return value of aio_complete()

2013-03-21 Thread Kent Overstreet
Nothing used the return value, and it probably wasn't possible to use it safely for the locked versions (aio_complete(), aio_put_req()). Just kill it. Signed-off-by: Kent Overstreet Acked-by: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc:

[PATCH 07/33] aio: add kiocb_cancel()

2013-03-21 Thread Kent Overstreet
Minor refactoring, to get rid of some duplicated code [a...@linux-foundation.org: fix warning] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc

[PATCH 12/33] aio: refcounting cleanup

2013-03-21 Thread Kent Overstreet
oint, other syscalls may still be submitting kiocbs! Now, we cancel and wait for outstanding kiocbs in free_ioctx(), after kioctx->users has dropped to 0 and we know no more iocbs could be submitted. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark

[PATCH 28/33] aio: kill ki_retry

2013-03-21 Thread Kent Overstreet
a...@linux-foundation.org: use fmode_t in aio_run_iocb()] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al Viro Cc: Benjam

[PATCH 20/33] aio: give shared kioctx fields their own cachelines

2013-03-21 Thread Kent Overstreet
[a...@linux-foundation.org: make reqs_active __cacheline_aligned_in_smp] Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff

[PATCH 24/33] aio: percpu ioctx refcount

2013-03-21 Thread Kent Overstreet
This just converts the ioctx refcount to the new generic dynamic percpu refcount code. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam

[PATCH 33/33] aio: fix kioctx not being freed after cancellation at exit time

2013-03-21 Thread Kent Overstreet
: Benjamin LaHaise Cc: Kent Overstreet Cc: Josh Boyer Cc: Zach Brown Signed-off-by: Andrew Morton Signed-off-by: Kent Overstreet --- fs/aio.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 4dbd240..d2c1a82 100644 --- a/fs/aio.c +++ b/fs

[PATCH 29/33] block: Prep work for batch completion

2013-03-21 Thread Kent Overstreet
Add a struct batch_complete * argument to bi_end_io; infrastructure to make use of it comes in the next patch. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc

[PATCH 11/33] aio: make aio_put_req() lockless

2013-03-21 Thread Kent Overstreet
tive list. This occurs in two places: kiocb_batch_free(), which is going away in a later patch, and the error path in io_submit_one. Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai

[PATCH 09/33] aio: dprintk() -> pr_debug()

2013-03-21 Thread Kent Overstreet
Signed-off-by: Kent Overstreet Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai Thambi S P Cc: Selvan Mani Cc: Sam Bradshaw Cc: Jeff Moyer Cc: Al Viro Cc: Benjamin LaHaise Cc: Theodore Ts'o Signed-o

[PATCH 04/33] aio: remove retry-based AIO

2013-03-21 Thread Kent Overstreet
removal of the locking around the unused run list in the submission path. This has only been compiled. Signed-off-by: Kent Overstreet Signed-off-by: Zach Brown Cc: Zach Brown Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Mark Fasheh Cc: Joel Becker Cc: Rusty Russell Cc: Jens Axboe Cc: Asai

Re: [LSF/MM TOPIC] Re: [dm-devel] Announcement: STEC EnhanceIO SSD caching software for Linux kernel

2013-02-04 Thread Kent Overstreet
On Fri, Jan 18, 2013 at 04:37:59PM -0500, Mike Snitzer wrote: > On Fri, Jan 18 2013 at 4:25pm -0500, > Darrick J. Wong wrote: > > > Since Joe is putting together a testing tree to compare the three caching > > things, what do you all think of having a(nother) session about ssd caching > > at >

Re: next-20130117 - kernel BUG with aio

2013-02-05 Thread Kent Overstreet
On Tue, Feb 05, 2013 at 10:53:00AM -0500, valdis.kletni...@vt.edu wrote: > On Thu, 31 Jan 2013 16:37:27 -0800, Kent Overstreet said: > > On Thu, Jan 31, 2013 at 01:59:52PM -0800, Andrew Morton wrote: > > > Did this get fixed? > > > With the patches I sent you, yes -

Re: [RFC] [DONOTAPPLY] [PATCH] enhanceio: STEC EnhanceIO SSD caching software for Linux kernel

2013-02-06 Thread Kent Overstreet
On Thu, Feb 07, 2013 at 06:57:40AM +0800, Amit Kale wrote: > > -Original Message- > > From: Michel Lespinasse [mailto:wal...@google.com] > > Sent: Friday, February 01, 2013 4:58 PM > > To: Darrick J. Wong > > Cc: Amit Kale; linux-bcache; device-mapper developm

Re: Improving AIO cancellation

2013-02-08 Thread Kent Overstreet
On Fri, Feb 08, 2013 at 09:38:11AM -0800, Zach Brown wrote: > > The draft implementation will look like this. struct bio should have > > some way to get current status of kiocb that generated bio. So we add > > a pointer to bool flag. > > > > struct bio { > > bool *cancelled; > > } > > > > in a

Re: [PATCH 23/32] Generic dynamic per cpu refcounting

2013-02-08 Thread Kent Overstreet
On Fri, Feb 08, 2013 at 06:44:08AM -0800, Tejun Heo wrote: > (cc'ing Andrew) > > On Wed, Dec 26, 2012 at 06:00:02PM -0800, Kent Overstreet wrote: > > This implements a refcount with similar semantics to > > atomic_get()/atomic_dec_and_test(), that starts out a

Re: [PATCH 23/32] Generic dynamic per cpu refcounting

2013-02-08 Thread Kent Overstreet
On Fri, Feb 08, 2013 at 03:49:02PM +0100, Jens Axboe wrote: > On Fri, Feb 08 2013, Tejun Heo wrote: > > (cc'ing Andrew) > > > > On Wed, Dec 26, 2012 at 06:00:02PM -0800, Kent Overstreet wrote: > > > This implements a refcount with similar semantics to >

[PATCH][WIP] dio rewrite

2013-02-11 Thread Kent Overstreet
I finally started hacking on the dio code, and it's far from done but it's turning out better than I expected so I thought I'd show off what I've got so far. The end result is _vastly_ simpler - direct-io.c is now ~700 lines, vs. ~1300 previously. dio_submit is almost gone, I'm down to 4 things le

Re: [PATCH][WIP] dio rewrite

2013-02-11 Thread Kent Overstreet
On Mon, Feb 11, 2013 at 05:24:13PM -0800, Andi Kleen wrote: > On Mon, Feb 11, 2013 at 04:53:26PM -0800, Kent Overstreet wrote: > > I finally started hacking on the dio code, and it's far from done but > > it's turning out better than I expected so I thought I'd sho

Re: bcache: BUG in fuzz testing without devices

2013-04-05 Thread Kent Overstreet
On Tue, Apr 02, 2013 at 12:21:02PM -0400, Sasha Levin wrote: > Hi all, > > It seems that trying to fuzz bcache without any devices triggers a BUG: > > That BUG looks very intentional there, any reason for adding it instead of > exiting > if there aren't any devices? The fuzz tester is meant to

Re: [PATCH] generic dynamic per cpu refcounting

2013-01-29 Thread Kent Overstreet
On Mon, Jan 28, 2013 at 01:50:42PM -0800, Tejun Heo wrote: > Hello, Kent. > > On Mon, Jan 28, 2013 at 01:45:06PM -0800, Kent Overstreet wrote: > > Ahh. Bias value sounds... hacky (i.e. harder to convince myself it's > > correct) but I see what you're getting at. >

[PATCH] module: Convert to generic percpu refcounts

2013-01-29 Thread Kent Overstreet
I started screwing aronud just to see how hard a conversion would be and what it'd look like. I _think_ this is complete, but there's enough going on I undoubtedly missed something. Completely untested - builds and that's it. I'm sure it's broken. Deletes almost 100 lines of code though. I like h

Re: [PATCH] generic dynamic per cpu refcounting

2013-01-29 Thread Kent Overstreet
On Tue, Jan 29, 2013 at 11:29:04AM -0800, Tejun Heo wrote: > Hey, Kent. > > On Tue, Jan 29, 2013 at 08:39:42AM -0800, Kent Overstreet wrote: > > Oh, if this is going to be widely used I should probably have a > > different implementation for archs that don't have atomic6

Re: [PATCH] generic dynamic per cpu refcounting

2013-01-29 Thread Kent Overstreet
On Tue, Jan 29, 2013 at 12:02:18PM -0800, Tejun Heo wrote: > Hello, Kent. > > On Tue, Jan 29, 2013 at 11:51:41AM -0800, Kent Overstreet wrote: > > > What about overflow? Note that we can have systemetic cases where ref > > > is gotten on one cpu and put on anoth

Re: next-20130117 - kernel BUG with aio

2013-01-31 Thread Kent Overstreet
On Thu, Jan 31, 2013 at 01:59:52PM -0800, Andrew Morton wrote: > On Tue, 22 Jan 2013 16:28:18 -0500 > valdis.kletni...@vt.edu wrote: > > > On Tue, 22 Jan 2013 21:43:27 +0800, Hillf Danton said: > > > On Mon, Jan 21, 2013 at 9:24 PM, Valdis Kletnieks > > > wrote: > > > > Am seeing a reproducible B

Re: [RFC] [DONOTAPPLY] [PATCH] enhanceio: STEC EnhanceIO SSD caching software for Linux kernel

2013-02-01 Thread Kent Overstreet
On Fri, Feb 1, 2013 at 4:57 PM, Michel Lespinasse wrote: > On Fri, Feb 1, 2013 at 4:44 PM, Darrick J. Wong > wrote: >> This is a patch to migrate STEC's enhanceio driver out of their github >> repository and into the staging tree. From their README: >> >> "EnhanceIO driver is based on EnhanceIO

Re: [RFC] [DONOTAPPLY] [PATCH] enhanceio: STEC EnhanceIO SSD caching software for Linux kernel

2013-02-01 Thread Kent Overstreet
Also, where's the end user documentation? On Fri, Feb 1, 2013 at 5:23 PM, Kent Overstreet wrote: > On Fri, Feb 1, 2013 at 4:57 PM, Michel Lespinasse wrote: >> On Fri, Feb 1, 2013 at 4:44 PM, Darrick J. Wong >> wrote: >>> This is a patch to migrate STEC's en

Re: next-20130117 - kernel BUG with aio

2013-01-24 Thread Kent Overstreet
On Thu, Jan 24, 2013 at 12:22:21PM -0500, valdis.kletni...@vt.edu wrote: > On Wed, 23 Jan 2013 20:10:03 +0800, Hillf Danton said: > > > Try again? > > --- > > > > --- a/fs/aio.c Tue Jan 22 21:37:54 2013 > > +++ b/fs/aio.c Wed Jan 23 20:06:14 2013 > > Now seeing this: > > [ 2941.495370]

Re: next-20130117 - kernel BUG with aio

2013-01-24 Thread Kent Overstreet
On Thu, Jan 24, 2013 at 01:27:59PM -0800, Andrew Morton wrote: > On Thu, 24 Jan 2013 13:18:50 -0800 > Kent Overstreet wrote: > > > So, Andrew - that "smoosh struct kiocb" patch should just be dropped, > > even if I fixed that issue clearly the idea is a lot less sa

[PATCH 1/3] aio: Fix a null pointer deref in batch_complete_aio

2013-01-24 Thread Kent Overstreet
The batch completion code was trying to be a bit too clever, and skip checking ctx where it couldn't be NULL - but that broke if a kiocb had been cancelled. Move the check to kioctx_ring_unlock(). Reported-by: Valdis Kletnieks Signed-off-by: Kent Overstreet --- fs/aio.c | 6 -- 1

[PATCH 2/3] aio-kill-ki_retry-fix-fix

2013-01-24 Thread Kent Overstreet
The "aio: kill ki-retry" patch was assuming that we didn't touch struct kiocb after passing it off to something that would call aio_complete() - which was wrong. So, revert the refcounting changes. Signed-off-by: Kent Overstreet --- fs/aio.c | 6 -- 1 file changed, 4 i

[PATCH 3/3] aio-use-cancellation-list-lazily-fix

2013-01-24 Thread Kent Overstreet
fficient since we're synchronizing with aio_complete() which isn't taking any locks. Signed-off-by: Kent Overstreet --- fs/aio.c| 32 ++-- include/linux/aio.h | 11 +++ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/fs/

Re: next-20130117 - kernel BUG with aio

2013-01-24 Thread Kent Overstreet
On Thu, Jan 24, 2013 at 01:27:59PM -0800, Andrew Morton wrote: > Please also take a look at Jan's recent > http://www.spinics.net/lists/linux-fsdevel/msg61738.html and have a > think about how this plays with your patchset. I can't think of any possible interactions - none of my aio stuff messes w

Re: next-20130117 - kernel BUG with aio

2013-01-24 Thread Kent Overstreet
On Thu, Jan 24, 2013 at 02:25:37PM -0800, Zach Brown wrote: > > No, I didn't see that bug until after I'd fixed the other three, but as > > far as I can tell everything's fixed with the patches I'm about to mail > > out - my test VM has been running for the past two days without errors, > > it's ki

Re: [dm-devel] Announcement: STEC EnhanceIO SSD caching software for Linux kernel

2013-01-24 Thread Kent Overstreet
On Thu, Jan 17, 2013 at 03:39:40AM -0800, Kent Overstreet wrote: > Suppose I could fill out the bcache version... > > On Thu, Jan 17, 2013 at 05:52:00PM +0800, Amit Kale wrote: > > 11. Error conditions - Handling power failures, intermittent and permanent > > device failures

Re: [dm-devel] Announcement: STEC EnhanceIO SSD caching software for Linux kernel

2013-01-24 Thread Kent Overstreet
On Fri, Jan 18, 2013 at 05:08:37PM +0800, Amit Kale wrote: > > From: Jason Warr [mailto:ja...@warr.net] > > On 01/17/2013 11:53 AM, Amit Kale wrote: > > >>> 9. Performance - Throughput is generally most important. Latency is > > >> > also one more performance comparison point. Performance under >

Re: [PATCH 23/32] Generic dynamic per cpu refcounting

2013-01-24 Thread Kent Overstreet
On Thu, Jan 24, 2013 at 04:51:36PM -0800, Tejun Heo wrote: > (cc'ing percpu / rcu crowd) > > Hello, Kent. > > On Wed, Dec 26, 2012 at 06:00:02PM -0800, Kent Overstreet wrote: > > This implements a refcount with similar semantics to > > atomic_get()/atomic_dec_and

Re: [PATCH 3/3] aio-use-cancellation-list-lazily-fix

2013-01-28 Thread Kent Overstreet
On Fri, Jan 25, 2013 at 03:12:51PM -0800, Andrew Morton wrote: > On Fri, 25 Jan 2013 21:30:32 +0800 > Hillf Danton wrote: > > > On Fri, Jan 25, 2013 at 5:43 AM, Kent Overstreet > > wrote: > > > The cancellation changes were fubar - we can't cancel a kiocb

Re: [PATCH 23/32] Generic dynamic per cpu refcounting

2013-01-28 Thread Kent Overstreet
On Thu, Jan 24, 2013 at 06:09:43PM -0800, Tejun Heo wrote: > Hello, again. > > On Thu, Jan 24, 2013 at 06:03:40PM -0800, Tejun Heo wrote: > > Yeah, if we're aiming to replace refcnts in file and kobj, dynamic > > alloc may be justified. Hopefully, the accounting necessary to decide > > whethre to

Re: [PATCH 23/32] Generic dynamic per cpu refcounting

2013-01-28 Thread Kent Overstreet
On Fri, Jan 25, 2013 at 04:45:10PM +1030, Rusty Russell wrote: > Tejun Heo writes: > >> It also implements two stage shutdown, as we need it to tear down the > >> percpu counts. Before dropping the initial refcount, you must call > >> percpu_ref_kill(); this puts the refcount in "shutting down mod

  1   2   3   4   5   6   7   8   9   10   >