Message ID | 20250203150525.456525-1-bigeasy@linutronix.de (mailing list archive) |
---|---|
Headers | show |
Series | ucount: Simplify refcounting with rcuref_t. | expand |
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@kernel.org> > 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 >
On 2025-02-03 16:05:21 [+0100], To linux-kernel@vger.kernel.org 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. Andrew, could you please take this series? Sebastian