sched/isolation: Make use of more than one housekeeping cpu
PATCH v2 1/1 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().
---
v2: Fix subject line. Update commit message. No code change.
kernel/sched/isolation.c | 2 +- kernel/sched/topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/sched/isolation.c +1 -1
@@ -40,7 +40,7 @@ int housekeeping_any_cpu(enum hk_type type)if (cpu < nr_cpu_ids)return cpu; - cpu =cpumask_any_and (housekeeping.cpumasks[type], cpu_online_mask); + cpu =cpumask_any_and_distribute (housekeeping.cpumasks[type], cpu_online_mask);if (likely (cpu < nr_cpu_ids))return cpu;/*
kernel/sched/topology.c +1 -1
@@ -2101,7 +2101,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)for (i =0 ; i < sched_domains_numa_levels; i++) {if (!masks[i][j])break ; - cpu =cpumask_any_and (cpus, masks[i][j]); + cpu =cpumask_any_and_distribute (cpus, masks[i][j]);if (cpu < nr_cpu_ids) { found = cpu;break ;
Signature · 1 line
2.47.1
Quoted 18 lines · Phil Auld
The exising code uses
housekeeping_any_cpu()to select a cpu for a given housekeeping task. However, this often ends up callingcpumask_any_and()which is defined ascpumask_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_tickwarning 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.
Quoted 4 lines
Spread the HK work out by having
housekeeping_any_cpu()andsched_numa_find_closest()usecpumask_any_and_distribute()instead ofcpumask_any_and().
LGTM.
Quoted 46 lines
Signed-off-by Phil Auld <[email protected]>Reviewed-by Waiman Long <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Juri Lelli <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Waiman Long <[email protected]>---
v2: Fix subject line. Update commit message. No code change.
kernel/sched/isolation.c | 2 +- kernel/sched/topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)kernel/sched/isolation.c +1
-1@@ -40,7 +40,7 @@ int housekeeping_any_cpu(enum hk_type type)if (cpu < nr_cpu_ids)return cpu; - cpu =cpumask_any_and (housekeeping.cpumasks[type], cpu_online_mask); + cpu =cpumask_any_and_distribute (housekeeping.cpumasks[type], cpu_online_mask);if (likely (cpu < nr_cpu_ids))return cpu;/* kernel/sched/topology.c +1
-1@@ -2101,7 +2101,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)for (i =0 ; i < sched_domains_numa_levels; i++) {if (!masks[i][j])break ; - cpu =cpumask_any_and (cpus, masks[i][j]); + cpu =cpumask_any_and_distribute (cpus, masks[i][j]);if (cpu < nr_cpu_ids) { found = cpu;break ;Signature · 1 line
2.47.1
Hi
Quoted 22 lines · On Tue, Feb 18, 2025 at 06:46:18PM +0000 Phil Auld wrote:
The exising code uses
housekeeping_any_cpu()to select a cpu for a given housekeeping task. However, this often ends up callingcpumask_any_and()which is defined ascpumask_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_tickwarning 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()andsched_numa_find_closest()usecpumask_any_and_distribute()instead ofcpumask_any_and().
Quoted 8 lines
Signed-off-by Phil Auld <[email protected]>Reviewed-by Waiman Long <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Juri Lelli <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Waiman Long <[email protected]>
Friendly ping...
Frederic, anyone else, thoughts?
Cheers,
Phil
Quoted 39 lines
---
v2: Fix subject line. Update commit message. No code change.
kernel/sched/isolation.c | 2 +- kernel/sched/topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)kernel/sched/isolation.c +1
-1@@ -40,7 +40,7 @@ int housekeeping_any_cpu(enum hk_type type)if (cpu < nr_cpu_ids)return cpu; - cpu =cpumask_any_and (housekeeping.cpumasks[type], cpu_online_mask); + cpu =cpumask_any_and_distribute (housekeeping.cpumasks[type], cpu_online_mask);if (likely (cpu < nr_cpu_ids))return cpu;/* kernel/sched/topology.c +1
-1@@ -2101,7 +2101,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)for (i =0 ; i < sched_domains_numa_levels; i++) {if (!masks[i][j])break ; - cpu =cpumask_any_and (cpus, masks[i][j]); + cpu =cpumask_any_and_distribute (cpus, masks[i][j]);if (cpu < nr_cpu_ids) { found = cpu;break ;Signature · 1 line
2.47.1
Quoted 22 lines · Phil Auld
The exising code uses
housekeeping_any_cpu()to select a cpu for a given housekeeping task. However, this often ends up callingcpumask_any_and()which is defined ascpumask_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_tickwarning 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()andsched_numa_find_closest()usecpumask_any_and_distribute()instead ofcpumask_any_and().
Quoted 8 lines
Signed-off-by Phil Auld <[email protected]>Reviewed-by Waiman Long <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Juri Lelli <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Waiman Long <[email protected]>
Quoted 32 lines · On Tue, Mar 04, 2025 at 02:24:19PM +0100 Frederic Weisbecker wrote:
Quoted 22 lines · Phil Auld
The exising code uses
housekeeping_any_cpu()to select a cpu for a given housekeeping task. However, this often ends up callingcpumask_any_and()which is defined ascpumask_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_tickwarning 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()andsched_numa_find_closest()usecpumask_any_and_distribute()instead ofcpumask_any_and().Quoted 8 lines
Signed-off-by Phil Auld <[email protected]>Reviewed-by Waiman Long <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Juri Lelli <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Waiman Long <[email protected]>
Quoted 2 lines
Thanks Frederic!
Anyone with commit powers willing to pick this up?
Thanks,
Phil
Quoted 32 lines · Phil Auld
Quoted 31 lines · On Tue, Mar 04, 2025 at 02:24:19PM +0100 Frederic Weisbecker wrote:
Quoted 30 lines · Phil Auld
The exising code uses
housekeeping_any_cpu()to select a cpu for a given housekeeping task. However, this often ends up callingcpumask_any_and()which is defined ascpumask_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_tickwarning 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()andsched_numa_find_closest()usecpumask_any_and_distribute()instead ofcpumask_any_and().Signed-off-by Phil Auld <[email protected]>Reviewed-by Waiman Long <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Juri Lelli <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Waiman Long <[email protected]>
Quoted 5 lines
Quoted 2 lines
Thanks Frederic!
Anyone with commit powers willing to pick this up?
Is this patch eligible to be merged into sched/core for the current cycle or will have to wait until the next one?
Thanks,
Longman
Hi Peter,
Quoted 37 lines · On Fri, Mar 14, 2025 at 07:38:22PM -0400 Waiman Long wrote:
Quoted 36 lines · Phil Auld
Quoted 31 lines · On Tue, Mar 04, 2025 at 02:24:19PM +0100 Frederic Weisbecker wrote:
Quoted 22 lines · Phil Auld
The exising code uses
housekeeping_any_cpu()to select a cpu for a given housekeeping task. However, this often ends up callingcpumask_any_and()which is defined ascpumask_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_tickwarning 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()andsched_numa_find_closest()usecpumask_any_and_distribute()instead ofcpumask_any_and().Quoted 8 lines
Signed-off-by Phil Auld <[email protected]>Reviewed-by Waiman Long <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Juri Lelli <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Waiman Long <[email protected]>Quoted 2 lines
Thanks Frederic!
Quoted 8 lines
Quoted 1 line
Anyone with commit powers willing to pick this up?
Is this patch eligible to be merged into sched/core for the current cycle or will have to wait until the next one?
Thanks,
Longman
This is the patch (in this thread somewhere...) I mentioned the other day at OSPM.
Thanks!
Cheers,
Phil
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 6432e163ba1b7d80b5876792ce53e511f041ab91 Gitweb: https://git.kernel.org/tip/6432e163ba1b7d80b5876792ce53e511f041ab91 Author: Phil Auld <[email protected]> AuthorDate: Tue, 18 Feb 2025 18:46:18 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 08 Apr 2025 20:55:55 +02:00
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().
--- kernel/sched/isolation.c | 2 +- kernel/sched/topology.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/sched/isolation.c +1 -1
@@ -40,7 +40,7 @@ int housekeeping_any_cpu(enum hk_type type)if (cpu < nr_cpu_ids)return cpu; - cpu =cpumask_any_and (housekeeping.cpumasks[type], cpu_online_mask); + cpu =cpumask_any_and_distribute (housekeeping.cpumasks[type], cpu_online_mask);if (likely (cpu < nr_cpu_ids))return cpu;/*
kernel/sched/topology.c +1 -1
@@ -2098,7 +2098,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)for (i =0 ; i < sched_domains_numa_levels; i++) {if (!masks[i][j])break ; - cpu =cpumask_any_and (cpus, masks[i][j]); + cpu =cpumask_any_and_distribute (cpus, masks[i][j]);if (cpu < nr_cpu_ids) { found = cpu;break ;