perf, core: Fix initial task_ctx/event installation
authorPeter Zijlstra <peterz@infradead.org>
Mon, 6 Jun 2011 22:23:28 +0000 (00:23 +0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 7 Jun 2011 11:02:41 +0000 (13:02 +0200)
commitb58f6b0dd3d677338b9065388cc2cc942b86338e
tree1c10cd87480b3c05b100fb4d85afaecfe2dd5b1b
parent3ce2a0bc9dfb6423491afe0afc9f099e24b8cba4
perf, core: Fix initial task_ctx/event installation

A lost Quilt refresh of 2c29ef0fef8 (perf: Simplify and fix
__perf_install_in_context()) is causing grief and lockups,
reported by Jiri Olsa.

When installing an event in a task context, there's a number of
issues:

 - there might not be an existing task context, in which case
   we should install the now current context;

 - there might already be a context, not the current one, in
   which case we should de-schedule the old and install the new;

these cases were dealt with in the lost refresh, however there is one
further case that was found in testing:

 - there might already be a context, the current one, in which
   case we should still de-schedule, and should take care
   to re-install it (note that task_ctx_sched_out() clears
   cpuctx->task_ctx).

Reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1307399008.2497.971.camel@laptop
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/events/core.c