On Mon, Feb 03, 2025 at 04:05:21PM +0100, Sebastian Andrzej Siewior wrote: > 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. The modification and later elimination of get_ucounts() threw me for a bit, but for the series: Reviewed-by: Paul E. McKenney <paulmck@xxxxxxxxxx> > 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 >