Skip to content

Commit 7e3b70e

Browse files
committed
rcu-tasks: Handle the running-offline idle-task special case
The idle task corresponding to an offline CPU can appear to be running while that CPU is offline. This commit therefore adds checks for this situation, treating it as a quiescent state. Because the tasklist scan and the holdout-list scan now exclude CPU-hotplug operations, readers on the CPU-hotplug paths are still waited for. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 81b4a7b commit 7e3b70e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/rcu/tasks.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,16 +818,20 @@ static bool trc_inspect_reader(struct task_struct *t, void *arg)
818818
{
819819
int cpu = task_cpu(t);
820820
bool in_qs = false;
821+
bool ofl = cpu_is_offline(cpu);
821822

822823
if (task_curr(t)) {
824+
WARN_ON_ONCE(ofl & !is_idle_task(t));
825+
823826
// If no chance of heavyweight readers, do it the hard way.
824-
if (!IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
827+
if (!ofl && !IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
825828
return false;
826829

827830
// If heavyweight readers are enabled on the remote task,
828831
// we can inspect its state despite its currently running.
829832
// However, we cannot safely change its state.
830-
if (!rcu_dynticks_zero_in_eqs(cpu, &t->trc_reader_nesting))
833+
if (!ofl && // Check for "running" idle tasks on offline CPUs.
834+
!rcu_dynticks_zero_in_eqs(cpu, &t->trc_reader_nesting))
831835
return false; // No quiescent state, do it the hard way.
832836
in_qs = true;
833837
} else {

0 commit comments

Comments
 (0)