public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 26/36] perf,rcu: convert call_rcu(free_ctx) to kfree_rcu()
@ 2011-03-18  4:07 Lai Jiangshan
  2011-03-18  9:35 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2011-03-18  4:07 UTC (permalink / raw)
  To: Paul E. McKenney, Ingo Molnar, Peter Zijlstra, Paul Mackerras,
	Ingo Molnar, Arnaldo Carvalho de Melo, linux-kernel



The rcu callback free_ctx() just calls a kfree(),
so we use kfree_rcu() instead of the call_rcu(free_ctx).

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/perf_event.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index ed253aa..b0581bd 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -584,14 +584,6 @@ static void get_ctx(struct perf_event_context *ctx)
 	WARN_ON(!atomic_inc_not_zero(&ctx->refcount));
 }
 
-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 (atomic_dec_and_test(&ctx->refcount)) {
@@ -599,7 +591,7 @@ static void put_ctx(struct perf_event_context *ctx)
 			put_ctx(ctx->parent_ctx);
 		if (ctx->task)
 			put_task_struct(ctx->task);
-		call_rcu(&ctx->rcu_head, free_ctx);
+		kfree_rcu(ctx, rcu_head);
 	}
 }
 
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 26/36] perf,rcu: convert call_rcu(free_ctx) to kfree_rcu()
  2011-03-18  4:07 [PATCH 26/36] perf,rcu: convert call_rcu(free_ctx) to kfree_rcu() Lai Jiangshan
@ 2011-03-18  9:35 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2011-03-18  9:35 UTC (permalink / raw)
  To: Lai Jiangshan
  Cc: Paul E. McKenney, Ingo Molnar, Paul Mackerras,
	Arnaldo Carvalho de Melo, linux-kernel

On Fri, 2011-03-18 at 12:07 +0800, Lai Jiangshan wrote:
> 
> The rcu callback free_ctx() just calls a kfree(),
> so we use kfree_rcu() instead of the call_rcu(free_ctx).
> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

Please take them through whatever tree adds kfree_rcu() as that doesn't
seem to be part of any tree near me.

> ---
>  kernel/perf_event.c |   10 +---------
>  1 files changed, 1 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index ed253aa..b0581bd 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -584,14 +584,6 @@ static void get_ctx(struct perf_event_context *ctx)
>  	WARN_ON(!atomic_inc_not_zero(&ctx->refcount));
>  }
>  
> -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 (atomic_dec_and_test(&ctx->refcount)) {
> @@ -599,7 +591,7 @@ static void put_ctx(struct perf_event_context *ctx)
>  			put_ctx(ctx->parent_ctx);
>  		if (ctx->task)
>  			put_task_struct(ctx->task);
> -		call_rcu(&ctx->rcu_head, free_ctx);
> +		kfree_rcu(ctx, rcu_head);
>  	}
>  }
>  


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-18  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-18  4:07 [PATCH 26/36] perf,rcu: convert call_rcu(free_ctx) to kfree_rcu() Lai Jiangshan
2011-03-18  9:35 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox