Skip to content

Commit fe4b04f

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <[email protected]>
1 parent b84defe commit fe4b04f

File tree

3 files changed

+172
-124
lines changed

3 files changed

+172
-124
lines changed

include/linux/sched.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,13 +2578,6 @@ static inline void inc_syscw(struct task_struct *tsk)
25782578
#define TASK_SIZE_OF(tsk) TASK_SIZE
25792579
#endif
25802580

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-
25882581
#ifdef CONFIG_MM_OWNER
25892582
extern void mm_update_next_owner(struct mm_struct *mm);
25902583
extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);

0 commit comments

Comments
 (0)