public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: cgel.zte@gmail.com, mingo@redhat.com
Cc: juri.lelli@redhat.com, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
	linux-kernel@vger.kernel.org, Lv Ruyi <lv.ruyi@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] sched/topology: avoid calling synchronize_rcu()
Date: Wed, 02 Mar 2022 14:19:55 +0000	[thread overview]
Message-ID: <87mti84et0.mognet@arm.com> (raw)
In-Reply-To: <20220302011433.2054613-1-lv.ruyi@zte.com.cn>

On 02/03/22 01:14, cgel.zte@gmail.com wrote:
> From: Lv Ruyi (CGEL ZTE) <lv.ruyi@zte.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@zte.com.cn>
> Signed-off-by: Lv Ruyi (CGEL ZTE) <lv.ruyi@zte.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

      reply	other threads:[~2022-03-02 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02  1:14 [PATCH] sched/topology: avoid calling synchronize_rcu() cgel.zte
2022-03-02 14:19 ` Valentin Schneider [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mti84et0.mognet@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=cgel.zte@gmail.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.ruyi@zte.com.cn \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=zealci@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox