Re: [RFC][PATCH 12/12] perf: Collapse and fix event_function_call() users
From: Peter Zijlstra
Date: Wed Jan 13 2016 - 05:51:09 EST
On Mon, Jan 11, 2016 at 05:25:10PM +0100, Peter Zijlstra wrote:
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -2202,44 +2219,28 @@ static void __perf_event_mark_enabled(st
> /*
> * Cross CPU call to enable a performance event
> */
> +static void __perf_event_enable(struct perf_event *event,
> + struct perf_cpu_context *cpuctx,
> + struct perf_event_context *ctx,
> + void *info)
> {
> struct perf_event *leader = event->group_leader;
> - struct perf_event_context *task_ctx = cpuctx->task_ctx;
deleted too much ^^
>
> if (event->state >= PERF_EVENT_STATE_INACTIVE)
> + return;
>
> + update_context_time(ctx);
> __perf_event_mark_enabled(event);
>
> + if (!ctx->is_active)
> + return;
> +
> if (!event_filter_match(event)) {
> + if (is_cgroup_event(event)) {
> + perf_cgroup_set_timestamp(current, ctx); // XXX ?
> perf_cgroup_defer_enabled(event);
> + }
> + return;
> }
>
> /*
> @@ -2247,19 +2248,9 @@ static int __perf_event_enable(void *inf
> * then don't put it on unless the group is on.
> */
> if (leader != event && leader->state != PERF_EVENT_STATE_ACTIVE)
> + return;
>
> + ctx_resched(cpuctx, ctx);
> }
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2225,6 +2243,7 @@ static void __perf_event_enable(struct p
void *info)
{
struct perf_event *leader = event->group_leader;
+ struct perf_event_context *task_ctx;
if (event->state >= PERF_EVENT_STATE_INACTIVE)
return;
@@ -2250,7 +2269,11 @@ static void __perf_event_enable(struct p
if (leader != event && leader->state != PERF_EVENT_STATE_ACTIVE)
return;
- ctx_resched(cpuctx, ctx);
+ task_ctx = cpuctx->task_ctx;
+ if (ctx->task)
+ WARN_ON_ONCE(task_ctx != ctx);
+
+ ctx_resched(cpuctx, task_ctx);
}
/*