I noticed that the atomic_dec_and_lock_irqsave() in put_ucounts() loops
sometimes even during boot. Something like 2-3 iterations but still.
This series replaces the refcounting with rcuref_t and adds a RCU
lookup.
This allows a lockless lookup in alloc_ucounts() if the entry is
available and a cmpxchg()less put of the item.

Patch #1 adds HLIST_NULLS_HEAD_INIT for which I added the RCU folks.

Sebastian

Sebastian Andrzej Siewior (4):
  rcu: Provide a static initializer for hlist_nulls_head.
  ucount: Replace get_ucounts_or_wrap() with atomic_inc_not_zero().
  ucount: Use RCU for ucounts lookups.
  ucount: Use rcuref_t for reference counting.

 include/linux/list_nulls.h     |  1 +
 include/linux/user_namespace.h | 15 ++++--
 kernel/ucount.c                | 97 +++++++++++++++-------------------
 3 files changed, 55 insertions(+), 58 deletions(-)

-- 
2.47.2


Reply via email to