Re: [RFC PATCH 1/2] lib/percpu-list: Per-cpu list with associated per-cpu locks
From: Christoph Lameter
Date: Wed Feb 17 2016 - 10:13:34 EST
On Tue, 16 Feb 2016, Waiman Long wrote:
> List entry insertion is strictly per cpu. List deletion, however, can
> happen in a cpu other than the one that did the insertion. So we still
> need lock to protect the list. Because of that, there may still be
> a small amount of contention when deletion is being done.
Is there a way to avoid locking completely? You could use cmpxchg_double
to swap both list head and tail in an atomic fashion with some work. There is
even a this_cpu_cmpxchg_double available.