diff mbox series

[1/4] sched/topology: convert call_rcu(free_ctx) to kfree_rcu()

Message ID 20241120064716.3361211-2-ranxiaokai627@163.com (mailing list archive)
State New
Headers show
Series Convert some simple call_rcu() to kfree_rcu()/kvfree_rcu() | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: mgorman@suse.de dietmar.eggemann@arm.com rostedt@goodmis.org vschneid@redhat.com bsegall@google.com
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 45 this patch: 45
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-11-20--15-00 (tests: 789)

Commit Message

Ran Xiaokai Nov. 20, 2024, 6:47 a.m. UTC
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>

The rcu callback free_asym_cap_entry() simply calls kfree().
It's better to directly call kfree_rcu().

Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
 kernel/sched/topology.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 9748a4c8d668..60ff3ba1d6ff 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1382,12 +1382,6 @@  asym_cpu_capacity_classify(const struct cpumask *sd_span,
 
 }
 
-static void free_asym_cap_entry(struct rcu_head *head)
-{
-	struct asym_cap_data *entry = container_of(head, struct asym_cap_data, rcu);
-	kfree(entry);
-}
-
 static inline void asym_cpu_capacity_update_data(int cpu)
 {
 	unsigned long capacity = arch_scale_cpu_capacity(cpu);
@@ -1438,7 +1432,7 @@  static void asym_cpu_capacity_scan(void)
 	list_for_each_entry_safe(entry, next, &asym_cap_list, link) {
 		if (cpumask_empty(cpu_capacity_span(entry))) {
 			list_del_rcu(&entry->link);
-			call_rcu(&entry->rcu, free_asym_cap_entry);
+			kfree_rcu(entry, rcu);
 		}
 	}
 
@@ -1449,7 +1443,7 @@  static void asym_cpu_capacity_scan(void)
 	if (list_is_singular(&asym_cap_list)) {
 		entry = list_first_entry(&asym_cap_list, typeof(*entry), link);
 		list_del_rcu(&entry->link);
-		call_rcu(&entry->rcu, free_asym_cap_entry);
+		kfree_rcu(entry, rcu);
 	}
 }