cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Meta kernel team <kernel-team@meta.com>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/psi: Remove the RCU wait from trigger destruction
Date: Wed, 14 Oct 2026 09:37:43 -1000	[thread overview]
Message-ID: <as_aB-eIeU16h_JN@slm.duckdns.org> (raw)
In-Reply-To: <20261010191500.3895736-1-shakeel.butt@linux.dev>

On Sat, Oct 10, 2026 at 12:15:00PM -0700, Shakeel Butt wrote:
> In the Meta fleet, we found PSI trigger destruction waiting for an RCU
> grace period while holding kernfs node_mutex, blocking other users [1].
> File close and node drain hold this mutex while calling the release
> callback. Cgroup removal and disabling cgroup.pressure also hold
> cgroup_mutex during the drain.
> 
> The wait was added by commit 0e94682b73bf ("psi: introduce psi monitor")
> to protect worker and trigger lookups. Commit 461daba06bdc
> ("psi: eliminate kthread_worker from psi trigger scheduling mechanism")
> replaced the worker queue with a group timer. The scheduler now only
> checks whether rtpoll_task is NULL; it uses neither the task nor the
> trigger. Commit a06247c6804f ("psi: Fix uaf issue when psi trigger is
> destroyed while being polled") removed trigger replacement and polling's
> RCU lookup.
> 
> Trigger lists are protected by mutexes. Proc poll/select entries are
> removed before their file references are dropped. eventpoll_release()
> removes epoll entries before the file release callback.
> Commit aff037078eca ("sched/psi: use kernfs polling functions for PSI
> trigger polling") moved cgroup polling to a kernfs waitqueue whose
> lifetime follows the file.
> 
> A late timer firing only wakes the group waitqueue. The system group is
> static, and commit 5457025fa8ca ("sched/psi: Shut down rtpoll_timer in
> psi_cgroup_free()") shuts down the cgroup timer before freeing the group.
> Cgroup reclamation already waits for scheduler readers.
> 
> Remove synchronize_rcu() from psi_trigger_destroy() and use
> rcu_access_pointer() for the worker NULL check. Keep kthread_stop()
> outside the trigger mutex.
> 
> Tested trigger churn, notifications and cgroup removal in an 8-CPU VM
> with KASAN, lockdep, and full and lazy preemption. No warnings were found.
> 
> Link: https://github.com/bpftrace/user-tools/tree/master/runnablelockmonitor [1]
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

      reply	other threads:[~2026-10-14 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 19:15 [PATCH] sched/psi: Remove the RCU wait from trigger destruction Shakeel Butt
2026-10-14 19:37 ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=as_aB-eIeU16h_JN@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).