mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] ucount: Simplify refcounting with rcuref_t.
@ 2025-02-03 15:05 Sebastian Andrzej Siewior
  2025-02-03 15:05 ` [PATCH 1/4] rcu: Provide a static initializer for hlist_nulls_head Sebastian Andrzej Siewior
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-02-03 15:05 UTC (permalink / raw)
  To: linux-kernel, rcu
  Cc: Andrew Morton, MengEn Sun, Thomas Gleixner, YueHong Wu,
	Paul E. McKenney, Joel Fernandes, Josh Triplett, Boqun Feng,
	Uladzislau Rezki, Steven Rostedt, Mathieu Desnoyers,
	Lai Jiangshan, Zqiang, Sebastian Andrzej Siewior

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-02-07 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-03 15:05 [PATCH 0/4] ucount: Simplify refcounting with rcuref_t Sebastian Andrzej Siewior
2025-02-03 15:05 ` [PATCH 1/4] rcu: Provide a static initializer for hlist_nulls_head Sebastian Andrzej Siewior
2025-02-03 15:05 ` [PATCH 2/4] ucount: Replace get_ucounts_or_wrap() with atomic_inc_not_zero() Sebastian Andrzej Siewior
2025-02-03 15:05 ` [PATCH 3/4] ucount: Use RCU for ucounts lookups Sebastian Andrzej Siewior
2025-02-03 15:05 ` [PATCH 4/4] ucount: Use rcuref_t for reference counting Sebastian Andrzej Siewior
2025-02-04  2:00 ` [PATCH 0/4] ucount: Simplify refcounting with rcuref_t Paul E. McKenney
2025-02-07 20:48 ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®