diff options
-rw-r--r-- | include/linux/perf_event.h | 2 | ||||
-rw-r--r-- | kernel/exit.c | 4 | ||||
-rw-r--r-- | kernel/perf_event.c | 8 |
3 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c1173520f14d..93bf53aa50e5 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -889,6 +889,7 @@ extern void perf_event_task_sched_out(struct task_struct *task, struct task_stru | |||
889 | extern int perf_event_init_task(struct task_struct *child); | 889 | extern int perf_event_init_task(struct task_struct *child); |
890 | extern void perf_event_exit_task(struct task_struct *child); | 890 | extern void perf_event_exit_task(struct task_struct *child); |
891 | extern void perf_event_free_task(struct task_struct *task); | 891 | extern void perf_event_free_task(struct task_struct *task); |
892 | extern void perf_event_delayed_put(struct task_struct *task); | ||
892 | extern void set_perf_event_pending(void); | 893 | extern void set_perf_event_pending(void); |
893 | extern void perf_event_do_pending(void); | 894 | extern void perf_event_do_pending(void); |
894 | extern void perf_event_print_debug(void); | 895 | extern void perf_event_print_debug(void); |
@@ -1067,6 +1068,7 @@ perf_event_task_sched_out(struct task_struct *task, | |||
1067 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } | 1068 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } |
1068 | static inline void perf_event_exit_task(struct task_struct *child) { } | 1069 | static inline void perf_event_exit_task(struct task_struct *child) { } |
1069 | static inline void perf_event_free_task(struct task_struct *task) { } | 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 | static inline void perf_event_do_pending(void) { } | 1072 | static inline void perf_event_do_pending(void) { } |
1071 | static inline void perf_event_print_debug(void) { } | 1073 | static inline void perf_event_print_debug(void) { } |
1072 | static inline int perf_event_task_disable(void) { return -EINVAL; } | 1074 | static inline int perf_event_task_disable(void) { return -EINVAL; } |
diff --git a/kernel/exit.c b/kernel/exit.c index 03120229db28..e2bdf37f9fde 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -149,9 +149,7 @@ static void delayed_put_task_struct(struct rcu_head *rhp) | |||
149 | { | 149 | { |
150 | struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); | 150 | struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); |
151 | 151 | ||
152 | #ifdef CONFIG_PERF_EVENTS | 152 | perf_event_delayed_put(tsk); |
153 | WARN_ON_ONCE(tsk->perf_event_ctxp); | ||
154 | #endif | ||
155 | trace_sched_process_free(tsk); | 153 | trace_sched_process_free(tsk); |
156 | put_task_struct(tsk); | 154 | put_task_struct(tsk); |
157 | } | 155 | } |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 9819a69a61a1..eaf1c5de6dcc 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -5893,6 +5893,14 @@ again: | |||
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 | * inherit a event from parent task to child task: | 5905 | * inherit a event from parent task to child task: |
5898 | */ | 5906 | */ |