Skip to content

Commit 6432e16

Browse files
auldpPeter Zijlstra
authored andcommitted
sched/isolation: Make use of more than one housekeeping cpu
The exising code uses housekeeping_any_cpu() to select a cpu for a given housekeeping task. However, this often ends up calling cpumask_any_and() which is defined as cpumask_first_and() which has the effect of alyways using the first cpu among those available. The same applies when multiple NUMA nodes are involved. In that case the first cpu in the local node is chosen which does provide a bit of spreading but with multiple HK cpus per node the same issues arise. We have numerous cases where a single HK cpu just cannot keep up and the remote_tick warning fires. It also can lead to the other things (orchastration sw, HA keepalives etc) on the HK cpus getting starved which leads to other issues. In these cases we recommend increasing the number of HK cpus. But... that only helps the userspace tasks somewhat. It does not help the actual housekeeping part. Spread the HK work out by having housekeeping_any_cpu() and sched_numa_find_closest() use cpumask_any_and_distribute() instead of cpumask_any_and(). Signed-off-by: Phil Auld <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Waiman Long <[email protected]> Reviewed-by: Vishal Chourasia <[email protected]> Acked-by: Frederic Weisbecker <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 690e47d commit 6432e16

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kernel/sched/isolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int housekeeping_any_cpu(enum hk_type type)
4040
if (cpu < nr_cpu_ids)
4141
return cpu;
4242

43-
cpu = cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
43+
cpu = cpumask_any_and_distribute(housekeeping.cpumasks[type], cpu_online_mask);
4444
if (likely(cpu < nr_cpu_ids))
4545
return cpu;
4646
/*

kernel/sched/topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2098,7 +2098,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)
20982098
for (i = 0; i < sched_domains_numa_levels; i++) {
20992099
if (!masks[i][j])
21002100
break;
2101-
cpu = cpumask_any_and(cpus, masks[i][j]);
2101+
cpu = cpumask_any_and_distribute(cpus, masks[i][j]);
21022102
if (cpu < nr_cpu_ids) {
21032103
found = cpu;
21042104
break;

0 commit comments

Comments
 (0)