* [PATCH] rcu-tasks: Warn on too-short RCU Tasks Rude grace period
@ 2026-10-15 9:46 Zqiang
2026-10-15 16:31 ` Bradley Morgan
0 siblings, 1 reply; 2+ messages in thread
From: Zqiang @ 2026-10-15 9:46 UTC (permalink / raw)
To: paulmck, frederic, neeraj.upadhyay, joelagnelf, urezki, boqun
Cc: qiang.zhang, rcu, linux-kernel
The RCU Tasks Rude grace period is implemented by invoking the
schedule_on_each_cpu() with an empty work function, which forces
a context switch on every online CPU and guarantees that all
rude-tasks read-side critical sections have completed. However,
schedule_on_each_cpu() can fail (via alloc_percpu() returning
-ENOMEM) and returns immediately, in which case those context
switches never happen, too-short grace period happen.
This commit therefore wraps the schedule_on_each_cpu() call in
WARN_ONCE() so that this failure is reported as a "Too-short
grace period" warning.
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
kernel/rcu/tasks.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index fcac7361ec51..91c25717402e 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -1361,7 +1361,8 @@ static void rcu_tasks_be_rude(struct work_struct *work)
static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp)
{
rtp->n_ipis += cpumask_weight(cpu_online_mask);
- schedule_on_each_cpu(rcu_tasks_be_rude);
+ WARN_ONCE(schedule_on_each_cpu(rcu_tasks_be_rude),
+ "%s: Too-short grace period, OOM is now expected behavior!!!\n", rtp->name);
}
static void call_rcu_tasks_rude(struct rcu_head *rhp, rcu_callback_t func);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] rcu-tasks: Warn on too-short RCU Tasks Rude grace period
2026-10-15 9:46 [PATCH] rcu-tasks: Warn on too-short RCU Tasks Rude grace period Zqiang
@ 2026-10-15 16:31 ` Bradley Morgan
0 siblings, 0 replies; 2+ messages in thread
From: Bradley Morgan @ 2026-10-15 16:31 UTC (permalink / raw)
To: qiang.zhang
Cc: boqun, frederic, joelagnelf, linux-kernel, neeraj.upadhyay,
paulmck, rcu, urezki
On 15 October 2026 10:46:19 BST, Zqiang <qiang.zhang@linux.dev> wrote:
>The RCU Tasks Rude grace period is implemented by invoking the
>schedule_on_each_cpu() with an empty work function, which forces
>a context switch on every online CPU and guarantees that all
>rude-tasks read-side critical sections have completed. However,
>schedule_on_each_cpu() can fail (via alloc_percpu() returning
>-ENOMEM) and returns immediately, in which case those context
>switches never happen, too-short grace period happen.
>
>This commit therefore wraps the schedule_on_each_cpu() call in
>WARN_ONCE() so that this failure is reported as a "Too-short
>grace period" warning.
NAK, this seems like a edge case, and potentially panicking the system
with panic on oops doesn't seem right to me, because we would reserve that
for when something definitely goes really wrong and we need to notify
the user.
I don't believe this patch should go in for this reason, it's a heavy edge
case, that doesn't *have* nessesarily need to be accounted for.
Zqiang, have you reproduced this OOM on your own system, if so, could you
tell me more details, you may turn my frown into a smiley face ;)
>
>Signed-off-by: Zqiang <qiang.zhang@linux.dev>
>---
> kernel/rcu/tasks.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
>index fcac7361ec51..91c25717402e 100644
>--- a/kernel/rcu/tasks.h
>+++ b/kernel/rcu/tasks.h
>@@ -1361,7 +1361,8 @@ static void rcu_tasks_be_rude(struct work_struct *work)
> static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp)
> {
> rtp->n_ipis += cpumask_weight(cpu_online_mask);
>- schedule_on_each_cpu(rcu_tasks_be_rude);
>+ WARN_ONCE(schedule_on_each_cpu(rcu_tasks_be_rude),
>+ "%s: Too-short grace period, OOM is now expected behavior!!!\n", rtp->name);
Good message, makes sense. But I don't think this is right, see above.
> }
>
> static void call_rcu_tasks_rude(struct rcu_head *rhp, rcu_callback_t
> func);
>
--- Thanks!
"I'm not a very positive person" - Linus torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-15 16:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 9:46 [PATCH] rcu-tasks: Warn on too-short RCU Tasks Rude grace period Zqiang
2026-10-15 16:31 ` Bradley Morgan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.