Skip to content

Commit 8db610c

Browse files
paulmckrcuurezki
authored andcommitted
rcu-tasks: Replace exit_tasks_rcu_start() initialization with WARN_ON_ONCE()
Because the Tasks RCU ->rtp_exit_list is initialized at rcu_init() time while there is only one CPU running with interrupts disabled, it is not possible for an exiting task to encounter an uninitialized list. This commit therefore replaces the conditional initialization with a WARN_ON_ONCE(). Reported-by: Frederic Weisbecker <[email protected]> Closes: https://lore.kernel.org/all/ZdiNXmO3wRvmzPsr@lothringen/ Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
1 parent c342b42 commit 8db610c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/rcu/tasks.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,7 @@ void exit_tasks_rcu_start(void)
12031203
rtpcp = this_cpu_ptr(rcu_tasks.rtpcpu);
12041204
t->rcu_tasks_exit_cpu = smp_processor_id();
12051205
raw_spin_lock_irqsave_rcu_node(rtpcp, flags);
1206-
if (!rtpcp->rtp_exit_list.next)
1207-
INIT_LIST_HEAD(&rtpcp->rtp_exit_list);
1206+
WARN_ON_ONCE(!rtpcp->rtp_exit_list.next);
12081207
list_add(&t->rcu_tasks_exit_list, &rtpcp->rtp_exit_list);
12091208
raw_spin_unlock_irqrestore_rcu_node(rtpcp, flags);
12101209
preempt_enable();

0 commit comments

Comments
 (0)