diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2022-05-18 02:38:02 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2022-06-20 18:22:29 +0200 |
commit | 19415004d5221ba59be6ef566fdbb52c44808f7e (patch) | |
tree | d66117cb3861158d14eb4f9129ffb9111bb8a3e1 | |
parent | rcu-tasks: Move rcu_tasks_trace_pertask() before rcu_tasks_trace_pregp_step() (diff) | |
download | linux-19415004d5221ba59be6ef566fdbb52c44808f7e.tar.xz linux-19415004d5221ba59be6ef566fdbb52c44808f7e.zip |
rcu-tasks: Avoid rcu_tasks_trace_pertask() duplicate list additions
This commit adds checks within rcu_tasks_trace_pertask() to avoid
duplicate (and destructive) additions to the holdouts list. These checks
will be required later due to the possibility of a given task having
blocked while in an RCU Tasks Trace read-side critical section, but now
running on a CPU.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: KP Singh <kpsingh@kernel.org>
-rw-r--r-- | kernel/rcu/tasks.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 66d8473f1bda..1aa6a24a9bc2 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -1454,9 +1454,10 @@ static void rcu_tasks_trace_pertask(struct task_struct *t, struct list_head *hop) { // During early boot when there is only the one boot CPU, there - // is no idle task for the other CPUs. Also, the grace-period - // kthread is always in a quiescent state. Either way, just return. - if (unlikely(t == NULL) || t == current) + // is no idle task for the other CPUs. Also, the grace-period + // kthread is always in a quiescent state. In addition, just return + // if this task is already on the list. + if (unlikely(t == NULL) || t == current || !list_empty(&t->trc_holdout_list)) return; rcu_st_need_qs(t, 0); |