diff options
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 8adf70e9e3cc..f32578634d9d 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -1084,8 +1084,10 @@ extern void perf_pmu_unregister(struct pmu *pmu); | |||
1084 | 1084 | ||
1085 | extern int perf_num_counters(void); | 1085 | extern int perf_num_counters(void); |
1086 | extern const char *perf_pmu_name(void); | 1086 | extern const char *perf_pmu_name(void); |
1087 | extern void __perf_event_task_sched(struct task_struct *prev, | 1087 | extern void __perf_event_task_sched_in(struct task_struct *prev, |
1088 | struct task_struct *next); | 1088 | struct task_struct *task); |
1089 | extern void __perf_event_task_sched_out(struct task_struct *prev, | ||
1090 | struct task_struct *next); | ||
1089 | extern int perf_event_init_task(struct task_struct *child); | 1091 | extern int perf_event_init_task(struct task_struct *child); |
1090 | extern void perf_event_exit_task(struct task_struct *child); | 1092 | extern void perf_event_exit_task(struct task_struct *child); |
1091 | extern void perf_event_free_task(struct task_struct *task); | 1093 | extern void perf_event_free_task(struct task_struct *task); |
@@ -1205,13 +1207,20 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr) | |||
1205 | 1207 | ||
1206 | extern struct static_key_deferred perf_sched_events; | 1208 | extern struct static_key_deferred perf_sched_events; |
1207 | 1209 | ||
1208 | static inline void perf_event_task_sched(struct task_struct *prev, | 1210 | static inline void perf_event_task_sched_in(struct task_struct *prev, |
1209 | struct task_struct *task) | 1211 | struct task_struct *task) |
1210 | { | 1212 | { |
1213 | if (static_key_false(&perf_sched_events.key)) | ||
1214 | __perf_event_task_sched_in(prev, task); | ||
1215 | } | ||
1216 | |||
1217 | static inline void perf_event_task_sched_out(struct task_struct *prev, | ||
1218 | struct task_struct *next) | ||
1219 | { | ||
1211 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); | 1220 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); |
1212 | 1221 | ||
1213 | if (static_key_false(&perf_sched_events.key)) | 1222 | if (static_key_false(&perf_sched_events.key)) |
1214 | __perf_event_task_sched(prev, task); | 1223 | __perf_event_task_sched_out(prev, next); |
1215 | } | 1224 | } |
1216 | 1225 | ||
1217 | extern void perf_event_mmap(struct vm_area_struct *vma); | 1226 | extern void perf_event_mmap(struct vm_area_struct *vma); |
@@ -1286,8 +1295,11 @@ extern void perf_event_disable(struct perf_event *event); | |||
1286 | extern void perf_event_task_tick(void); | 1295 | extern void perf_event_task_tick(void); |
1287 | #else | 1296 | #else |
1288 | static inline void | 1297 | static inline void |
1289 | perf_event_task_sched(struct task_struct *prev, | 1298 | perf_event_task_sched_in(struct task_struct *prev, |
1290 | struct task_struct *task) { } | 1299 | struct task_struct *task) { } |
1300 | static inline void | ||
1301 | perf_event_task_sched_out(struct task_struct *prev, | ||
1302 | struct task_struct *next) { } | ||
1291 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } | 1303 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } |
1292 | static inline void perf_event_exit_task(struct task_struct *child) { } | 1304 | static inline void perf_event_exit_task(struct task_struct *child) { } |
1293 | static inline void perf_event_free_task(struct task_struct *task) { } | 1305 | static inline void perf_event_free_task(struct task_struct *task) { } |