perf fixes
Linus,
Please pull the latest perf-fixes-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git perf-fixes-for-linus
Thanks,
Ingo
------------------>
Eric Dumazet (1):
perf: Fix a build error with some GCC versions
Stephane Eranian (1):
perf_event: Fix cgrp event scheduling bug in perf_enable_on_exec()
kernel/perf_event.c | 12 ++++++++++++ tools/perf/util/cgroup.c | 2 +- 2 files changed, 13 insertions(+), 1 deletions(-)
kernel/perf_event.c +12 -0
@@ -364,6 +364,7 @@ void perf_cgroup_switch(struct task_struct *task, int mode) }if (mode &PERF_CGROUP_SWIN ) { +WARN_ON_ONCE (cpuctx->cgrp);/* set cgrp before ctxsw in to * allow event_filter_match() to not * have to pass task around
@@ -2423,6 +2424,14 @@ static void perf_event_enable_on_exec(struct perf_event_context *ctx)if (!ctx || !ctx->nr_events) goto out; +/* +* We must ctxsw out cgroup events to avoid conflict +* when invoking perf_task_event_sched_in() later on +* in this function. Otherwise we end up trying to +* ctxswin cgroup events which are already scheduled +* in. +*/ +perf_cgroup_sched_out (current);task_ctx_sched_out (ctx,EVENT_ALL );raw_spin_lock (&ctx->lock);
@@ -2447,6 +2456,9 @@ static void perf_event_enable_on_exec(struct perf_event_context *ctx)raw_spin_unlock (&ctx->lock); +/* +* Also calls ctxswin for cgroup events, if any: +*/ perf_event_context_sched_in (ctx, ctx->task); out:local_irq_restore (flags);
tools/perf/util/cgroup.c +1 -1
@@ -13,7 +13,7 @@ cgroupfs_find_mountpoint(char *buf, size_t maxlen) {FILE *fp;char mountpoint[MAX_PATH +1 ], tokens[MAX_PATH +1 ], type[MAX_PATH +1 ]; -char *token, *saved_ptr; +char *token, *saved_ptr =NULL ;int found =0 ; fp =fopen ("/proc/mounts" ,"r" );