Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-09 Thread Peter Zijlstra
On Thu, Nov 09, 2017 at 09:24:08AM -0800, Davidlohr Bueso wrote: > On Wed, 08 Nov 2017, Boqun Feng wrote: > > Or worse: > > > > * CPU0 CPU1 > > * dlock_list_add() dlock_lists_empty() > > *smp_mb__bef

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-09 Thread Davidlohr Bueso
On Wed, 08 Nov 2017, Boqun Feng wrote: Or worse: * CPU0 CPU1 * dlock_list_add() dlock_lists_empty() *smp_mb__before_atomic(); *[L] atomic_re

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-07 Thread Boqun Feng
On Tue, Nov 07, 2017 at 10:59:29AM -0700, Andreas Dilger wrote: > On Nov 7, 2017, at 4:59 AM, Jan Kara wrote: > > On Mon 06-11-17 10:47:08, Davidlohr Bueso wrote: > >> + /* > >> + * Serialize dlist->used_lists such that a 0->1 transition is not > >> + * missed by another thread checking if an

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-07 Thread James Bottomley
On Tue, 2017-11-07 at 13:57 -0500, Waiman Long wrote: > On 11/07/2017 12:59 PM, Andreas Dilger wrote: > > > > On Nov 7, 2017, at 4:59 AM, Jan Kara wrote: > > > > > > On Mon 06-11-17 10:47:08, Davidlohr Bueso wrote: > > > > > > > > + /* > > > > +  * Serialize dlist->used_lists such t

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-07 Thread Waiman Long
On 11/07/2017 12:59 PM, Andreas Dilger wrote: > On Nov 7, 2017, at 4:59 AM, Jan Kara wrote: >> On Mon 06-11-17 10:47:08, Davidlohr Bueso wrote: >>> + /* >>> +* Serialize dlist->used_lists such that a 0->1 transition is not >>> +* missed by another thread checking if any of the dlock list

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-07 Thread Andreas Dilger
On Nov 7, 2017, at 4:59 AM, Jan Kara wrote: > On Mon 06-11-17 10:47:08, Davidlohr Bueso wrote: >> +/* >> + * Serialize dlist->used_lists such that a 0->1 transition is not >> + * missed by another thread checking if any of the dlock lists are >> + * used. >> + * >> + * CPU0

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-07 Thread Jan Kara
On Mon 06-11-17 10:47:08, Davidlohr Bueso wrote: > Instead of the current O(N) implementation, at the cost > of adding an atomic counter, we can convert the call to > an atomic_read(). The counter only serves for accounting > empty to non-empty transitions, and vice versa; therefore > only modified

Re: [PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-06 Thread Waiman Long
On 11/06/2017 01:47 PM, Davidlohr Bueso wrote: > Instead of the current O(N) implementation, at the cost > of adding an atomic counter, we can convert the call to > an atomic_read(). The counter only serves for accounting > empty to non-empty transitions, and vice versa; therefore > only modified t

[PATCH v4] lib/dlock-list: Scale dlock_lists_empty()

2017-11-06 Thread Davidlohr Bueso
Instead of the current O(N) implementation, at the cost of adding an atomic counter, we can convert the call to an atomic_read(). The counter only serves for accounting empty to non-empty transitions, and vice versa; therefore only modified twice for each of the lists during the lifetime of the dl