Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated per-cpu locks

From: Peter Zijlstra
Date: Wed Feb 17 2016 - 06:05:34 EST


On Wed, Feb 17, 2016 at 12:00:40PM +0100, Peter Zijlstra wrote:
> On Wed, Feb 17, 2016 at 08:53:18PM +1100, Dave Chinner wrote:
> > > +/**
> > > + * for_all_percpu_list_entries - iterate over all the per-cpu list with locking

But the locking is 'pointless'. You only lock one per-cpu sublist at a
time, therefore the list can be modified concurrently anyhow.

So why not use RCU for the list iteration and avoid potentially large
lock hold times?

> > > + * @pos: the type * to use as a loop cursor for the current .
> > > + * @next: an internal type * variable pointing to the next entry
> > > + * @pchead: an internal struct list * of percpu list head
> > > + * @pclock: an internal variable for the current per-cpu spinlock
> > > + * @head: the head of the per-cpu list
> > > + * @member: the name of the per-cpu list within the struct
> > > + */