* [PATCH] sched/topology: avoid calling synchronize_rcu()
@ 2022-03-02 1:14 cgel.zte
2022-03-02 14:19 ` Valentin Schneider
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-03-02 1:14 UTC (permalink / raw)
To: mingo
Cc: juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall,
mgorman, bristot, linux-kernel, Lv Ruyi, Zeal Robot
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);
for (i = 0; i < nr_levels && masks; i++) {
if (!masks[i])
continue;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sched/topology: avoid calling synchronize_rcu()
2022-03-02 1:14 [PATCH] sched/topology: avoid calling synchronize_rcu() cgel.zte
@ 2022-03-02 14:19 ` Valentin Schneider
0 siblings, 0 replies; 2+ messages in thread
From: Valentin Schneider @ 2022-03-02 14:19 UTC (permalink / raw)
To: cgel.zte, mingo
Cc: juri.lelli, vincent.guittot, dietmar.eggemann, rostedt, bsegall,
mgorman, bristot, linux-kernel, Lv Ruyi, Zeal Robot
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-02 14:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 1:14 [PATCH] sched/topology: avoid calling synchronize_rcu() cgel.zte
2022-03-02 14:19 ` Valentin Schneider
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).