aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_event.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2012-05-08 12:56:04 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-09 09:23:17 -0400
commitcb04ff9ac424d0e689d9b612e9f73cb443ab4b7e (patch)
tree7335f4ca82dc0366ffbf9dc8de5396259213435a /include/linux/perf_event.h
parent8b1e13638d465863572c8207a5cfceeef0cf0441 (diff)
sched, perf: Use a single callback into the scheduler
We can easily use a single callback for both sched-in and sched-out. This reduces the code footprint in the scheduler path as well as removes the PMU black spot otherwise present between the out and in callback. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-o56ajxp1edwqg6x9d31wb805@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r--include/linux/perf_event.h24
1 files changed, 6 insertions, 18 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f32578634d9d..8adf70e9e3cc 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1084,10 +1084,8 @@ extern void perf_pmu_unregister(struct pmu *pmu);
1084 1084
1085extern int perf_num_counters(void); 1085extern int perf_num_counters(void);
1086extern const char *perf_pmu_name(void); 1086extern const char *perf_pmu_name(void);
1087extern void __perf_event_task_sched_in(struct task_struct *prev, 1087extern void __perf_event_task_sched(struct task_struct *prev,
1088 struct task_struct *task); 1088 struct task_struct *next);
1089extern void __perf_event_task_sched_out(struct task_struct *prev,
1090 struct task_struct *next);
1091extern int perf_event_init_task(struct task_struct *child); 1089extern int perf_event_init_task(struct task_struct *child);
1092extern void perf_event_exit_task(struct task_struct *child); 1090extern void perf_event_exit_task(struct task_struct *child);
1093extern void perf_event_free_task(struct task_struct *task); 1091extern void perf_event_free_task(struct task_struct *task);
@@ -1207,20 +1205,13 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1207 1205
1208extern struct static_key_deferred perf_sched_events; 1206extern struct static_key_deferred perf_sched_events;
1209 1207
1210static inline void perf_event_task_sched_in(struct task_struct *prev, 1208static inline void perf_event_task_sched(struct task_struct *prev,
1211 struct task_struct *task) 1209 struct task_struct *task)
1212{ 1210{
1213 if (static_key_false(&perf_sched_events.key))
1214 __perf_event_task_sched_in(prev, task);
1215}
1216
1217static inline void perf_event_task_sched_out(struct task_struct *prev,
1218 struct task_struct *next)
1219{
1220 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0); 1211 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1221 1212
1222 if (static_key_false(&perf_sched_events.key)) 1213 if (static_key_false(&perf_sched_events.key))
1223 __perf_event_task_sched_out(prev, next); 1214 __perf_event_task_sched(prev, task);
1224} 1215}
1225 1216
1226extern void perf_event_mmap(struct vm_area_struct *vma); 1217extern void perf_event_mmap(struct vm_area_struct *vma);
@@ -1295,11 +1286,8 @@ extern void perf_event_disable(struct perf_event *event);
1295extern void perf_event_task_tick(void); 1286extern void perf_event_task_tick(void);
1296#else 1287#else
1297static inline void 1288static inline void
1298perf_event_task_sched_in(struct task_struct *prev, 1289perf_event_task_sched(struct task_struct *prev,
1299 struct task_struct *task) { } 1290 struct task_struct *task) { }
1300static inline void
1301perf_event_task_sched_out(struct task_struct *prev,
1302 struct task_struct *next) { }
1303static inline int perf_event_init_task(struct task_struct *child) { return 0; } 1291static inline int perf_event_init_task(struct task_struct *child) { return 0; }
1304static inline void perf_event_exit_task(struct task_struct *child) { } 1292static inline void perf_event_exit_task(struct task_struct *child) { }
1305static inline void perf_event_free_task(struct task_struct *task) { } 1293static inline void perf_event_free_task(struct task_struct *task) { }