From: Krister Johansen <kjlx@templeofstupid.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Cruz Zhao <CruzZhao@linux.alibaba.com>,
tip-bot2@linutronix.de, linux-kernel@vger.kernel.org,
linux-tip-commits@vger.kernel.org, mingo@kernel.org,
x86@kernel.org, Peng Wang <peng_wang@linux.alibaba.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [tip:sched/urgent] sched/fair: Clear ->h_load_next when unregistering a cgroup
Date: Fri, 2 Jan 2026 17:47:02 -0800 [thread overview]
Message-ID: <aVh1Fiar6aC4W_1D@templeofstupid.com> (raw)
In-Reply-To: <CAKfTPtCQW_Oj+P6nGx0nVO01CahSEqxuToO8kg=oe3yfuViOwg@mail.gmail.com>
Hi Vincent,
On Mon, Dec 29, 2025 at 02:58:16PM +0100, Vincent Guittot wrote:
> On Mon, 29 Dec 2025 at 13:51, Cruz Zhao <CruzZhao@linux.alibaba.com> wrote:
> > I noticed that the following patch has been queued in the
> > tip:sched/urgent branch for some time but hasn't yet made
> > it into mainline:
> > https://lore.kernel.org/all/176478073513.498.15089394378873483436.tip-bot2@tip-bot2/
> >
> > Could you please check if there's anything blocking its
> > merge? I wanted to ensure it doesn’t get overlooked.
>
> From an off list discussion w/ Peter, we need to check that this patch
> is not hiding the root cause that task_h_load is not called in the
> right context i.e. with rcu_read_lock(). Peter pointed out one place
> in numa [1]
>
> [1] https://lore.kernel.org/all/20251015124422.GD3419281@noisy.programming.kicks-ass.net/
If it helps, I've double-checked this code a few times. When I looked,
there were 7 different callers of task_h_load(), and they decompose into
3 cases.
1. rcu_read_lock is held as we expect
2. the numa balancing cases Peter already identified
3. tick related invocations, where the caller is in interrupt context
For 3, there's an edge case where deferred work is scheduled if the
target cpu is in full nohz mode and has stopped.
In the cases where I'm hitting this bug, the systems aren't using numa
balancing and aren't using nohz. 90% of ones I've analyzed are in a
futex wakeup and are holding the rcu_read_lock.
This seems like just a case of the pointer continuing to reference
memory that was already free'd. If the task group's sched entity is
freed, but the parent cfs_rq still has a pointer to that sched_entity in
h_load_next, then it may end up accessing that memory accidentally if we
do not clear it.
Put another way, even if all of these callers used rcu_read_lock, there
would still be a need to ensure that the parent's h_load_next doesn't
point to a sched entity that is free'd once the RCU read-side critical
section is exited, because the child is getting free'd and not the
parent. The (freed) child is still discoverable from the parent's
h_load_next after the critical section because the delete code does not
clear h_load_next and order that write before the free.
-K
next prev parent reply other threads:[~2026-01-03 1:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 16:52 [tip: sched/urgent] " tip-bot2 for Peng Wang
2025-12-29 12:50 ` [tip:sched/urgent] " Cruz Zhao
2025-12-29 13:58 ` Vincent Guittot
2026-01-03 1:47 ` Krister Johansen [this message]
2026-01-12 17:32 ` Vincent Guittot
2026-01-15 8:27 ` Krister Johansen
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=aVh1Fiar6aC4W_1D@templeofstupid.com \
--to=kjlx@templeofstupid.com \
--cc=CruzZhao@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peng_wang@linux.alibaba.com \
--cc=peterz@infradead.org \
--cc=tip-bot2@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®