Re: [PATCH] cpuhp: Expedite synchronize_rcu during SMT switch

From: Peter Zijlstra

Date: Mon Jan 19 2026 - 09:59:45 EST


On Mon, Jan 19, 2026 at 09:45:48AM -0500, Joel Fernandes wrote:
> On Sun, Jan 19, 2026 at 03:11:18PM +0100, Peter Zijlstra wrote:
> > By holding an extra rcu_sync reference, the percpu rwsem is kept into
> > the the slow path, avoiding the rcu-sync on down_write(), which was very
> > prevalent per this:
> >
> > https://lkml.kernel.org/r/aWU9HRcs4ghazIRg@xxxxxxxxxxxxx
>
> Makes sense, though I wonder if we should have a separate percpu-rwsem API
> for this rather than directly accessing the lock-internal rcu_sync state?
> Other future percpu_rw_semaphore users may benefit as well.

Yeah, perhaps. There is one other user, the above makes two.

kernel/cgroup/cgroup.c: rcu_sync_enter(&cgroup_threadgroup_rwsem.rss);