Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-11 Thread Davidlohr Bueso
On Sat, 2014-01-11 at 01:52 -0800, Paul E. McKenney wrote: [...] > On Sat, Jan 11, 2014 at 01:49:12AM -0800, Paul E. McKenney wrote: > > On Thu, Jan 02, 2014 at 07:05:20AM -0800, Davidlohr Bueso wrote: > > > - spin_lock(>lock); > > > + spin_lock(>lock); /* implies MB (A) */ > > > > You need

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-11 Thread Paul E. McKenney
On Sat, Jan 11, 2014 at 01:49:12AM -0800, Paul E. McKenney wrote: > On Thu, Jan 02, 2014 at 07:05:20AM -0800, Davidlohr Bueso wrote: > > From: Davidlohr Bueso > > > > In futex_wake() there is clearly no point in taking the hb->lock if we know > > beforehand that there are no tasks to be woken.

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-11 Thread Paul E. McKenney
On Thu, Jan 02, 2014 at 07:05:20AM -0800, Davidlohr Bueso wrote: > From: Davidlohr Bueso > > In futex_wake() there is clearly no point in taking the hb->lock if we know > beforehand that there are no tasks to be woken. While the hash bucket's plist > head is a cheap way of knowing this, we

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-11 Thread Paul E. McKenney
On Thu, Jan 02, 2014 at 07:05:20AM -0800, Davidlohr Bueso wrote: From: Davidlohr Bueso davidl...@hp.com In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be woken. While the hash bucket's plist head is a cheap way of knowing

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-11 Thread Paul E. McKenney
On Sat, Jan 11, 2014 at 01:49:12AM -0800, Paul E. McKenney wrote: On Thu, Jan 02, 2014 at 07:05:20AM -0800, Davidlohr Bueso wrote: From: Davidlohr Bueso davidl...@hp.com In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-11 Thread Davidlohr Bueso
On Sat, 2014-01-11 at 01:52 -0800, Paul E. McKenney wrote: [...] On Sat, Jan 11, 2014 at 01:49:12AM -0800, Paul E. McKenney wrote: On Thu, Jan 02, 2014 at 07:05:20AM -0800, Davidlohr Bueso wrote: - spin_lock(hb-lock); + spin_lock(hb-lock); /* implies MB (A) */ You need

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-07 Thread Darren Hart
On Mon, 2014-01-06 at 19:29 -0800, Davidlohr Bueso wrote: > On Mon, 2014-01-06 at 12:52 -0800, Darren Hart wrote: > > On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote: > > I thought someone, Peter Z?, had commented on these CONFIG_SMP bits. Are > > they really necessary? Does

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-07 Thread Darren Hart
On Mon, 2014-01-06 at 19:29 -0800, Davidlohr Bueso wrote: On Mon, 2014-01-06 at 12:52 -0800, Darren Hart wrote: On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote: I thought someone, Peter Z?, had commented on these CONFIG_SMP bits. Are they really necessary? Does

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-06 Thread Davidlohr Bueso
On Mon, 2014-01-06 at 12:52 -0800, Darren Hart wrote: > On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote: > > From: Davidlohr Bueso > > > > In futex_wake() there is clearly no point in taking the hb->lock if we know > > beforehand that there are no tasks to be woken. While the hash

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-06 Thread Darren Hart
On Thu, 2014-01-02 at 12:59 -0800, Davidlohr Bueso wrote: > On Thu, 2014-01-02 at 11:23 -0800, Linus Torvalds wrote: > > On Thu, Jan 2, 2014 at 7:05 AM, Davidlohr Bueso wrote: > > > > > > In futex_wake() there is clearly no point in taking the hb->lock if we > > > know > > > beforehand that

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-06 Thread Darren Hart
On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote: > From: Davidlohr Bueso > > In futex_wake() there is clearly no point in taking the hb->lock if we know > beforehand that there are no tasks to be woken. While the hash bucket's plist > head is a cheap way of knowing this, we cannot rely

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-06 Thread Darren Hart
On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote: From: Davidlohr Bueso davidl...@hp.com In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be woken. While the hash bucket's plist head is a cheap way of knowing this, we

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-06 Thread Darren Hart
On Thu, 2014-01-02 at 12:59 -0800, Davidlohr Bueso wrote: On Thu, 2014-01-02 at 11:23 -0800, Linus Torvalds wrote: On Thu, Jan 2, 2014 at 7:05 AM, Davidlohr Bueso davidl...@hp.com wrote: In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-06 Thread Davidlohr Bueso
On Mon, 2014-01-06 at 12:52 -0800, Darren Hart wrote: On Thu, 2014-01-02 at 07:05 -0800, Davidlohr Bueso wrote: From: Davidlohr Bueso davidl...@hp.com In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be woken. While the hash

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-02 Thread Davidlohr Bueso
On Thu, 2014-01-02 at 11:23 -0800, Linus Torvalds wrote: > On Thu, Jan 2, 2014 at 7:05 AM, Davidlohr Bueso wrote: > > > > In futex_wake() there is clearly no point in taking the hb->lock if we know > > beforehand that there are no tasks to be woken. > > Btw, I think we could optimize this a bit

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-02 Thread Linus Torvalds
On Thu, Jan 2, 2014 at 7:05 AM, Davidlohr Bueso wrote: > > In futex_wake() there is clearly no point in taking the hb->lock if we know > beforehand that there are no tasks to be woken. Btw, I think we could optimize this a bit further for the wakeup case. wake_futex() does a

[PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-02 Thread Davidlohr Bueso
From: Davidlohr Bueso In futex_wake() there is clearly no point in taking the hb->lock if we know beforehand that there are no tasks to be woken. While the hash bucket's plist head is a cheap way of knowing this, we cannot rely 100% on it as there is a racy window between the futex_wait call and

[PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-02 Thread Davidlohr Bueso
From: Davidlohr Bueso davidl...@hp.com In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be woken. While the hash bucket's plist head is a cheap way of knowing this, we cannot rely 100% on it as there is a racy window between the

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-02 Thread Linus Torvalds
On Thu, Jan 2, 2014 at 7:05 AM, Davidlohr Bueso davidl...@hp.com wrote: In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be woken. Btw, I think we could optimize this a bit further for the wakeup case. wake_futex() does a

Re: [PATCH v5 4/4] futex: Avoid taking hb lock if nothing to wakeup

2014-01-02 Thread Davidlohr Bueso
On Thu, 2014-01-02 at 11:23 -0800, Linus Torvalds wrote: On Thu, Jan 2, 2014 at 7:05 AM, Davidlohr Bueso davidl...@hp.com wrote: In futex_wake() there is clearly no point in taking the hb-lock if we know beforehand that there are no tasks to be woken. Btw, I think we could optimize this