[SRU][J][PATCH 1/2] rcu-tasks: fix mismerge in trc_inspect_reader
Krister Johansen
kjlx at templeofstupid.com
Fri Nov 22 09:46:17 UTC 2024
Upstream converted the '!nesting' to 'nesting ? -EINVAL : 0' as part of a manual
conflict resolution during their merge of 9b3c4ab304("sched,rcu: Rework
try_invoke_on_locked_down_task()").
When this change was pulled into the Ubuntu trees the resulting conflict was
incorrectly resolved when the patch was cherry-picked. Continuing to use
'!nesting' results in trc_inspect_reader erroneously flagging tasks as holdouts
when they are actually quiescent. This subsequently results in IPIs being sent
to CPUs where one is not needed. Additionally, on platforms that have CPU
hotplug slots empty, this also results in WARNs about errors sending IPIs to
invalid CPUs. Resolving the conflict in the same fashion as linux has addresses
this problem.
Signed-off-by: Krister Johansen <kjlx at templeofstupid.com>
---
kernel/rcu/tasks.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index b9f762c2b083..5528c172570b 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -982,7 +982,7 @@ static int trc_inspect_reader(struct task_struct *t, void *arg)
// holdout list.
t->trc_reader_checked = nesting >= 0;
if (nesting <= 0)
- return !nesting; // If in QS, done, otherwise try again later.
+ return nesting ? -EINVAL : 0; // If in QS, done, otherwise try again later.
// The task is in a read-side critical section, so set up its
// state so that it will awaken the grace-period kthread upon exit
--
2.25.1
More information about the kernel-team
mailing list