From: Peter Zijlstra Date: Sat, 9 Apr 2011 19:17:48 +0000 (+0200) Subject: perf: De-schedule a task context when removing the last event X-Git-Tag: MMI-PSA29.97-13-9~18912^2~46 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64ce312618ef0e11d88def80effcefd1b59fdb1e;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git perf: De-schedule a task context when removing the last event Since perf_install_in_context() will now install a context when we add the first event, we can de-schedule the context when the last event is removed. Signed-off-by: Peter Zijlstra Link: http://lkml.kernel.org/r/20110409192142.090431763@chello.nl Signed-off-by: Ingo Molnar --- diff --git a/kernel/events/core.c b/kernel/events/core.c index c378062da277..cc5d57d1d0b6 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1120,6 +1120,10 @@ static int __perf_remove_from_context(void *info) raw_spin_lock(&ctx->lock); event_sched_out(event, cpuctx, ctx); list_del_event(event, ctx); + if (!ctx->nr_events && cpuctx->task_ctx == ctx) { + ctx->is_active = 0; + cpuctx->task_ctx = NULL; + } raw_spin_unlock(&ctx->lock); return 0;