mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
rcu-tasks: Handle idle tasks for recently offlined CPUs
This commit identifies idle tasks for recently offlined CPUs as residing in a quiescent state. This is safe only because CPU-hotplug operations are excluded during these checks. 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>
This commit is contained in:
parent
5c9a9ca44f
commit
897ba84dc5
1 changed files with 7 additions and 8 deletions
|
@ -1318,27 +1318,26 @@ static int trc_inspect_reader(struct task_struct *t, void *bhp_in)
|
||||||
int nesting;
|
int nesting;
|
||||||
bool ofl = cpu_is_offline(cpu);
|
bool ofl = cpu_is_offline(cpu);
|
||||||
|
|
||||||
if (task_curr(t)) {
|
if (task_curr(t) && !ofl) {
|
||||||
WARN_ON_ONCE(ofl && !is_idle_task(t));
|
|
||||||
|
|
||||||
// If no chance of heavyweight readers, do it the hard way.
|
// If no chance of heavyweight readers, do it the hard way.
|
||||||
if (!ofl && !IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
|
if (!IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
// If heavyweight readers are enabled on the remote task,
|
// If heavyweight readers are enabled on the remote task,
|
||||||
// we can inspect its state despite its currently running.
|
// we can inspect its state despite its currently running.
|
||||||
// However, we cannot safely change its state.
|
// However, we cannot safely change its state.
|
||||||
n_heavy_reader_attempts++;
|
n_heavy_reader_attempts++;
|
||||||
if (!ofl && // Check for "running" idle tasks on offline CPUs.
|
// Check for "running" idle tasks on offline CPUs.
|
||||||
!rcu_dynticks_zero_in_eqs(cpu, &t->trc_reader_nesting))
|
if (!rcu_dynticks_zero_in_eqs(cpu, &t->trc_reader_nesting))
|
||||||
return -EINVAL; // No quiescent state, do it the hard way.
|
return -EINVAL; // No quiescent state, do it the hard way.
|
||||||
n_heavy_reader_updates++;
|
n_heavy_reader_updates++;
|
||||||
if (ofl)
|
|
||||||
n_heavy_reader_ofl_updates++;
|
|
||||||
nesting = 0;
|
nesting = 0;
|
||||||
} else {
|
} else {
|
||||||
// The task is not running, so C-language access is safe.
|
// The task is not running, so C-language access is safe.
|
||||||
nesting = t->trc_reader_nesting;
|
nesting = t->trc_reader_nesting;
|
||||||
|
WARN_ON_ONCE(ofl && task_curr(t) && !is_idle_task(t));
|
||||||
|
if (IS_ENABLED(CONFIG_TASKS_TRACE_RCU_READ_MB) && ofl)
|
||||||
|
n_heavy_reader_ofl_updates++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not exiting a read-side critical section, mark as checked
|
// If not exiting a read-side critical section, mark as checked
|
||||||
|
|
Loading…
Add table
Reference in a new issue