lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1c1bfa7-f1ba-8590-65fb-df6b8c0d1168@arm.com>
Date:   Wed, 1 Jun 2022 10:45:00 +0200
From:   Dietmar Eggemann <dietmar.eggemann@....com>
To:     Bing Huang <huangbing@...inos.cn>, peterz@...radead.org
Cc:     brauner@...nel.org, bristot@...hat.com, bsegall@...gle.com,
        juri.lelli@...hat.com, linux-kernel@...r.kernel.org,
        mgorman@...e.de, mingo@...hat.com, rostedt@...dmis.org,
        vincent.guittot@...aro.org
Subject: Re: [PATCH v2] sched/fair: static cpumasks for load balance

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@...inos.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).

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ