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] [day] [month] [year] [list]
Message-ID: <87mti84et0.mognet@arm.com>
Date:   Wed, 02 Mar 2022 14:19:55 +0000
From:   Valentin Schneider <valentin.schneider@....com>
To:     cgel.zte@...il.com, mingo@...hat.com
Cc:     juri.lelli@...hat.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
        mgorman@...e.de, bristot@...hat.com, linux-kernel@...r.kernel.org,
        Lv Ruyi <lv.ruyi@....com.cn>, Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] sched/topology: avoid calling synchronize_rcu()

On 02/03/22 01:14, cgel.zte@...il.com wrote:
> From: Lv Ruyi (CGEL ZTE) <lv.ruyi@....com.cn>
>
> Kfree_rcu() usually results in even simpler code than does
> synchronize_rcu() without synchronize_rcu()'s multi-millisecond
> latency, so replace synchronize_rcu() with kfree_rcu().
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Lv Ruyi (CGEL ZTE) <lv.ruyi@....com.cn>
> ---
>  kernel/sched/topology.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 974212620fa1..0ce302b4d732 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -1970,8 +1970,7 @@ static void sched_reset_numa(void)
>       if (distances || masks) {
>               int i, j;
>
> -		synchronize_rcu();
> -		kfree(distances);
> +		kfree_rcu(distances);

What about the freeing of the cpumasks below? You don't want to free those
before the end of the grace period either. With that in mind, I think the
current synchronize_rcu() + batch of kfree()'s is fine, it's a slow path
anyway (hotplug).


>               for (i = 0; i < nr_levels && masks; i++) {
>                       if (!masks[i])
>                               continue;
> --
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ