[PATCH] sched/topology: avoid calling synchronize_rcu()

From: cgel . zte
Date: Tue Mar 01 2022 - 20:14:48 EST


From: Lv Ruyi (CGEL ZTE) <lv.ruyi@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Lv Ruyi (CGEL ZTE) <lv.ruyi@xxxxxxxxxx>
---
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