Commit 4e231c7962ce711c7d8c2a4dc23ecd1e8fc28363
Committed by
Ingo Molnar
1 parent
1b9a644fec
Exists in
master
and in
4 other branches
perf: Fix up delayed_put_task_struct()
I missed a perf_event_ctxp user when converting it to an array. Pull this last user into perf_event.c as well and fix it up. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 3 changed files with 11 additions and 3 deletions Side-by-side Diff
include/linux/perf_event.h
... | ... | @@ -889,6 +889,7 @@ |
889 | 889 | extern int perf_event_init_task(struct task_struct *child); |
890 | 890 | extern void perf_event_exit_task(struct task_struct *child); |
891 | 891 | extern void perf_event_free_task(struct task_struct *task); |
892 | +extern void perf_event_delayed_put(struct task_struct *task); | |
892 | 893 | extern void set_perf_event_pending(void); |
893 | 894 | extern void perf_event_do_pending(void); |
894 | 895 | extern void perf_event_print_debug(void); |
... | ... | @@ -1067,6 +1068,7 @@ |
1067 | 1068 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } |
1068 | 1069 | static inline void perf_event_exit_task(struct task_struct *child) { } |
1069 | 1070 | static inline void perf_event_free_task(struct task_struct *task) { } |
1071 | +static inline void perf_event_delayed_put(struct task_struct *task) { } | |
1070 | 1072 | static inline void perf_event_do_pending(void) { } |
1071 | 1073 | static inline void perf_event_print_debug(void) { } |
1072 | 1074 | static inline int perf_event_task_disable(void) { return -EINVAL; } |
kernel/exit.c
... | ... | @@ -149,9 +149,7 @@ |
149 | 149 | { |
150 | 150 | struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); |
151 | 151 | |
152 | -#ifdef CONFIG_PERF_EVENTS | |
153 | - WARN_ON_ONCE(tsk->perf_event_ctxp); | |
154 | -#endif | |
152 | + perf_event_delayed_put(tsk); | |
155 | 153 | trace_sched_process_free(tsk); |
156 | 154 | put_task_struct(tsk); |
157 | 155 | } |
kernel/perf_event.c
... | ... | @@ -5893,6 +5893,14 @@ |
5893 | 5893 | } |
5894 | 5894 | } |
5895 | 5895 | |
5896 | +void perf_event_delayed_put(struct task_struct *task) | |
5897 | +{ | |
5898 | + int ctxn; | |
5899 | + | |
5900 | + for_each_task_context_nr(ctxn) | |
5901 | + WARN_ON_ONCE(task->perf_event_ctxp[ctxn]); | |
5902 | +} | |
5903 | + | |
5896 | 5904 | /* |
5897 | 5905 | * inherit a event from parent task to child task: |
5898 | 5906 | */ |