[PATCH-v3 1/4] idr: Percpu ida

2013-08-16 Thread Nicholas A. Bellinger
From: Kent Overstreet Percpu frontend for allocating ids. With percpu allocation (that works), it's impossible to guarantee it will always be possible to allocate all nr_tags - typically, some will be stuck on a remote percpu freelist where the current job can't get to them. We do guarantee that

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-26 Thread Kent Overstreet
On Tue, Aug 20, 2013 at 02:31:57PM -0700, Andrew Morton wrote: > On Fri, 16 Aug 2013 23:09:06 + "Nicholas A. Bellinger" > wrote: > > > From: Kent Overstreet > > > > Percpu frontend for allocating ids. With percpu allocation (that works), > > it's impossible to guarantee it will always be p

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-26 Thread Kent Overstreet
On Wed, Aug 21, 2013 at 06:25:58PM +, Christoph Lameter wrote: > On Fri, 16 Aug 2013, Nicholas A. Bellinger wrote: > > > + spinlock_t lock; > > Remove the spinlock. As Andrew noted, the spinlock is needed because of tag stealing. (You don't think I'd stick a spinlock o

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-28 Thread Kent Overstreet
On Tue, Aug 20, 2013 at 02:31:57PM -0700, Andrew Morton wrote: > On Fri, 16 Aug 2013 23:09:06 + "Nicholas A. Bellinger" > wrote: > > + /* > > +* Bitmap of cpus that (may) have tags on their percpu freelists: > > +* steal_tags() uses this to decide when to steal tags, and which cpus

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-28 Thread Andrew Morton
On Wed, 28 Aug 2013 12:53:17 -0700 Kent Overstreet wrote: > > > + while (1) { > > > + spin_lock(&pool->lock); > > > + > > > + /* > > > + * prepare_to_wait() must come before steal_tags(), in case > > > + * percpu_ida_free() on another cpu flips a bit in > > > +

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-28 Thread Kent Overstreet
On Wed, Aug 28, 2013 at 01:23:32PM -0700, Andrew Morton wrote: > On Wed, 28 Aug 2013 12:53:17 -0700 Kent Overstreet wrote: > > > > > + while (1) { > > > > + spin_lock(&pool->lock); > > > > + > > > > + /* > > > > +* prepare_to_wait() must come befo

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-28 Thread Andrew Morton
On Wed, 28 Aug 2013 13:44:54 -0700 Kent Overstreet wrote: > > > > What guarantees that this wait will terminate? > > > > > > It seems fairly clear to me from the break statement a couple lines up; > > > if we were passed __GFP_WAIT we terminate iff we succesfully allocated a > > > tag. If we wer

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-28 Thread Kent Overstreet
On Wed, Aug 28, 2013 at 01:50:42PM -0700, Andrew Morton wrote: > On Wed, 28 Aug 2013 13:44:54 -0700 Kent Overstreet wrote: > > > > > > What guarantees that this wait will terminate? > > > > > > > > It seems fairly clear to me from the break statement a couple lines up; > > > > if we were passed

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-28 Thread Andrew Morton
On Wed, 28 Aug 2013 14:12:17 -0700 Kent Overstreet wrote: > How's this look? > > diff --git a/lib/idr.c b/lib/idr.c > index 15c021c..a3f8e9a 100644 > --- a/lib/idr.c > +++ b/lib/idr.c > @@ -1288,6 +1288,11 @@ static inline unsigned alloc_local_tag(struct > percpu_ida *pool, > * Safe to be cal

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-20 Thread Andrew Morton
On Fri, 16 Aug 2013 23:09:06 + "Nicholas A. Bellinger" wrote: > From: Kent Overstreet > > Percpu frontend for allocating ids. With percpu allocation (that works), > it's impossible to guarantee it will always be possible to allocate all > nr_tags - typically, some will be stuck on a remote

Re: [PATCH-v3 1/4] idr: Percpu ida

2013-08-21 Thread Christoph Lameter
On Fri, 16 Aug 2013, Nicholas A. Bellinger wrote: > + spinlock_t lock; Remove the spinlock. > + unsignednr_free; > + unsignedfreelist[]; > +}; > + > +static inline void move_tags(unsigned *dst, unsigned *dst_nr, > +