lkml.org 
[lkml]   [2022]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH v2] sched/fair: static cpumasks for load balance
From
On 31/05/2022 05:12, Bing Huang wrote:
> The both cpu mask load_balance_mask and select_idle_mask just only used
> in fair.c, but allocation in core.c in CONFIG_CPUMASK_OFFSTACK=y case,
> and global via declare per cpu variations. More or less, it looks wired.
>
> Signed-off-by: Bing Huang <huangbing@kylinos.cn>
> ---
>
> v2: move load_balance_mask and select_idle_mask allocation from
> sched_init() to init_sched_fair_class()

This would align CFS with RT (local_cpu_mask) and DL
(local_cpu_mask_dl).

[...]

> @@ -11841,6 +11841,16 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m)
> __init void init_sched_fair_class(void)
> {
> #ifdef CONFIG_SMP

`int i` missing for DEBUG_PER_CPU_MAPS/CONFIG_CPUMASK_OFFSTACK case.

> +
> +#ifdef CONFIG_CPUMASK_OFFSTACK
> + for_each_possible_cpu(i) {
> + per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node(
> + cpumask_size(), GFP_KERNEL, cpu_to_node(i));
> + per_cpu(select_idle_mask, i) = (cpumask_var_t)kzalloc_node(
> + cpumask_size(), GFP_KERNEL, cpu_to_node(i));
> + }
> +#endif
> +

What about:

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 98319b654788..9ef5133c72d6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11811,15 +11811,14 @@ void show_numa_stats(struct task_struct *p, struct seq_file *m)
__init void init_sched_fair_class(void)
{
#ifdef CONFIG_SMP
+ int i;

-#ifdef CONFIG_CPUMASK_OFFSTACK
for_each_possible_cpu(i) {
- per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node(
- cpumask_size(), GFP_KERNEL, cpu_to_node(i));
- per_cpu(select_idle_mask, i) = (cpumask_var_t)kzalloc_node(
- cpumask_size(), GFP_KERNEL, cpu_to_node(i));
+ zalloc_cpumask_var_node(&per_cpu(load_balance_mask, i),
+ GFP_KERNEL, cpu_to_node(i));
+ zalloc_cpumask_var_node(&per_cpu(select_idle_mask, i),
+ GFP_KERNEL, cpu_to_node(i));
}
-#endif

to get rid of the #ifdef ? We do the same for RT (local_cpu_mask) and DL
(local_cpu_mask_dl).

[...]
\
 
 \ /
  Last update: 2022-06-01 10:47    [W:0.086 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site