diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-02-02 07:19:09 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-02-03 06:14:43 -0500 |
commit | fe4b04fa31a6dcf4358aa84cf81e5a7fd079469b (patch) | |
tree | 20a6db874d0db2a2f2e38e3ff77df4bdaa5f1cfe /include/linux/sched.h | |
parent | b84defe6036e6dea782d41b80a4590e54f249671 (diff) |
perf: Cure task_oncpu_function_call() races
Oleg reported that on architectures with
__ARCH_WANT_INTERRUPTS_ON_CTXSW the IPI from
task_oncpu_function_call() can land before perf_event_task_sched_in()
and cause interesting situations for eg. perf_install_in_context().
This patch reworks the task_oncpu_function_call() interface to give a
more usable primitive as well as rework all its users to hopefully be
more obvious as well as remove the races.
While looking at the code I also found a number of races against
perf_event_task_sched_out() which can flip contexts between tasks so
plug those too.
Reported-and-reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index d747f948b34e..0b40ee3f6d7a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2578,13 +2578,6 @@ static inline void inc_syscw(struct task_struct *tsk) | |||
2578 | #define TASK_SIZE_OF(tsk) TASK_SIZE | 2578 | #define TASK_SIZE_OF(tsk) TASK_SIZE |
2579 | #endif | 2579 | #endif |
2580 | 2580 | ||
2581 | /* | ||
2582 | * Call the function if the target task is executing on a CPU right now: | ||
2583 | */ | ||
2584 | extern void task_oncpu_function_call(struct task_struct *p, | ||
2585 | void (*func) (void *info), void *info); | ||
2586 | |||
2587 | |||
2588 | #ifdef CONFIG_MM_OWNER | 2581 | #ifdef CONFIG_MM_OWNER |
2589 | extern void mm_update_next_owner(struct mm_struct *mm); | 2582 | extern void mm_update_next_owner(struct mm_struct *mm); |
2590 | extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); | 2583 | extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); |