[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241120064716.3361211-3-ranxiaokai627@163.com>
Date: Wed, 20 Nov 2024 06:47:14 +0000
From: Ran Xiaokai <ranxiaokai627@....com>
To: juri.lelli@...hat.com,
vincent.guittot@...aro.org,
mingo@...hat.com,
peterz@...radead.org,
pshelar@....org,
davem@...emloft.net
Cc: linux-kernel@...r.kernel.org,
ran.xiaokai@....com.cn,
linux-perf-users@...r.kernel.org,
netdev@...r.kernel.org,
dev@...nvswitch.org
Subject: [PATCH 2/4] perf/core: convert call_rcu(free_ctx) to kfree_rcu()
From: Ran Xiaokai <ran.xiaokai@....com.cn>
The rcu callback free_ctx() simply calls kfree().
It's better to directly call kfree_rcu().
Signed-off-by: Ran Xiaokai <ran.xiaokai@....com.cn>
---
kernel/events/core.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 065f9188b44a..7f4cc9c41bbe 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1210,14 +1210,6 @@ static void free_task_ctx_data(struct pmu *pmu, void *task_ctx_data)
kmem_cache_free(pmu->task_ctx_cache, task_ctx_data);
}
-static void free_ctx(struct rcu_head *head)
-{
- struct perf_event_context *ctx;
-
- ctx = container_of(head, struct perf_event_context, rcu_head);
- kfree(ctx);
-}
-
static void put_ctx(struct perf_event_context *ctx)
{
if (refcount_dec_and_test(&ctx->refcount)) {
@@ -1225,7 +1217,7 @@ static void put_ctx(struct perf_event_context *ctx)
put_ctx(ctx->parent_ctx);
if (ctx->task && ctx->task != TASK_TOMBSTONE)
put_task_struct(ctx->task);
- call_rcu(&ctx->rcu_head, free_ctx);
+ kfree_rcu(ctx, rcu_head);
}
}
--
2.17.1
Powered by blists - more mailing lists