From: Andrew Morton <akpm@linux-foundation.org>
To: paulmck@kernel.org
Cc: syzbot <syzbot+d2401aeb74cc84adba04@syzkaller.appspotmail.com>,
hannes@cmpxchg.org, jackmanb@google.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
mhocko@suse.com, surenb@google.com,
syzkaller-bugs@googlegroups.com, vbabka@kernel.org,
ziy@nvidia.com
Subject: Re: [syzbot] [mm?] INFO: rcu detected stall in khugepaged (3)
Date: Wed, 5 Aug 2026 23:03:11 -0700 [thread overview]
Message-ID: <20260805230311.2bbda85fb92abcf12d85194e@linux-foundation.org> (raw)
In-Reply-To: <d5771d33-d8f8-4fcf-911b-089e862042e5@paulmck-laptop>
On Wed, 5 Aug 2026 13:28:16 -0700 "Paul E. McKenney" <paulmck@kernel.org> wrote:
> > collapse_scan_file()'s main loop has
> >
> > if (need_resched()) {
> > xas_pause(&xas);
> > cond_resched_rcu();
> > }
> >
> > but that won't help with the RCU stall detector(?).
> >
> > I suggest that a suitable fix here would be to add the analogous
> >
> > if (rcu_i_need_to_take_a_break()) {
> > rcu_read_unlock();
> > rcu_take_a_break())
> > rcu_read_lock();
> > }
> >
> > (iirc rcu_read_unlock() does an rcu run, so rcu_take_a_break() isn't
> > needed here)
> >
> > Paul, wdyt?
>
> Let's see...
>
> The console log says "rcu_preempt detected stalls on CPUs/tasks",
> which means that cond_resched() is a no-op, but it also means that
> the rcu_read_unlock() in cond_resched_rcu() will directly take care of
> informing RCU of the pause.
>
> But that is clearly not happening. Why?
>
> Well, we have this:
>
> rcu: Tasks blocked on level-0 rcu_node (CPUs 0-1): P37/1:b..l
>
> This means that the task whose RCU read-side critical section is blocking
> the current RCU grace period isn't even running, and thus cannot invoke
> cond_resched_rcu(), let alone the rcu_read_unlock() within that function.
> So an RCU CPU stall warning is expected behavior. Or at least it is not
> in any way ruled out.
>
> What we need is RCU priority boosting.
Do we? I'm suggesting we need need_resched_rcu()!
> Except that the .config file
> does not enable this. Not only is there no CONFIG_RCU_BOOST=y, there
> is also no CONFIG_RCU_EXPERT=y and no CONFIG_PREEMPT_RT=y. But there
> is CONFIG_RT_MUTEX=y and CONFIG_RCU_EXPERT=y.
>
> Because we don't have RCU priority boosting, if the load on the system
> is heavy enough to prevent our poor preempted RCU reader (PID 37) from
> running, the grace period cannot end.
>
> I am not sure why this task is saving its stack, but maybe that is normal
> for this code path?
>
> My bemusement aside, I recommend running this test either with
> non-preemptible RCU (CONFIG_PREEMPT_LAZY=y these days) or enabling RCU
> priority boosting (CONFIG_RCU_EXPERT=y and CONFIG_RCU_BOOST=y).
>
> Maybe RCU_BOOST should no longer depend on RCU_EXPERT? I would of
> course need ot remove the prompt ("Enable RCU priority boosting") to
> avoid annoying Linus. Maybe as shown below.
>
> Thoughts?
If I'm understanding correctly, this workload is busted with this
config and the proposed fix is to alter the config? Well, why are we
permitting that config at all?
Seems to me that a solution to permit this config to work is very
simple. Something like:
time_t start;
rcu_read_lock();
start = current_time();
for (lots of work) {
...
if (need_resched_rcu(start)) {
cond_resched_rcu();
start = current_time();
}
Where need_resched_rcu() tests to see if we're getting close to hitting
the watchdog timeout.
No?
next prev parent reply other threads:[~2026-08-06 6:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 0:01 [syzbot] [mm?] INFO: rcu detected stall in khugepaged (3) syzbot
2026-08-05 19:29 ` Andrew Morton
2026-08-05 20:28 ` Paul E. McKenney
2026-08-06 6:03 ` Andrew Morton [this message]
2026-08-06 16:27 ` Paul E. McKenney
2026-08-06 8:18 ` Vlastimil Babka (SUSE)
2026-08-06 17:19 ` Paul E. McKenney
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=20260805230311.2bbda85fb92abcf12d85194e@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=paulmck@kernel.org \
--cc=surenb@google.com \
--cc=syzbot+d2401aeb74cc84adba04@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.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