Skip to content

Commit 7634b1e

Browse files
committed
rcu: Exclude outgoing CPU when it is the last to leave
The rcu_boost_kthread_setaffinity() function removes the outgoing CPU from the set_cpus_allowed() mask for the corresponding leaf rcu_node structure's rcub priority-boosting kthread. Except that if the outgoing CPU will leave that structure without any online CPUs, the mask is set to the housekeeping CPU mask from housekeeping_cpumask(). Which is fine unless the outgoing CPU happens to be a housekeeping CPU. This commit therefore removes the outgoing CPU from the housekeeping mask. This would of course be problematic if the outgoing CPU was the last online housekeeping CPU, but in that case you are in a world of hurt anyway. If someone comes up with a valid use case for a system needing all the housekeeping CPUs to be offline, further adjustments can be made. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 621189a commit 7634b1e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/rcu/tree_plugin.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,8 +1243,11 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu)
12431243
cpu != outgoingcpu)
12441244
cpumask_set_cpu(cpu, cm);
12451245
cpumask_and(cm, cm, housekeeping_cpumask(HK_TYPE_RCU));
1246-
if (cpumask_empty(cm))
1246+
if (cpumask_empty(cm)) {
12471247
cpumask_copy(cm, housekeeping_cpumask(HK_TYPE_RCU));
1248+
if (outgoingcpu >= 0)
1249+
cpumask_clear_cpu(outgoingcpu, cm);
1250+
}
12481251
set_cpus_allowed_ptr(t, cm);
12491252
mutex_unlock(&rnp->boost_kthread_mutex);
12501253
free_cpumask_var(cm);

0 commit comments

Comments
 (0)