Skip to content

Commit

Permalink
perf,rcu: convert call_rcu(free_ctx) to kfree_rcu()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
  • Loading branch information
Lai Jiangshan authored and Paul E. McKenney committed May 8, 2011
1 parent 1f8d36a commit cb796ff
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,22 +586,14 @@ 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)) {
if (ctx->parent_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);
}
}

Expand Down

0 comments on commit cb796ff

Please sign in to comment.