aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2014-11-04 21:55:58 -0500
committerIngo Molnar <mingo@kernel.org>2015-02-18 11:16:02 -0500
commitba532500c5651a4be4108acc64ed99a95cb005b3 (patch)
tree6fe0a328c1b461bea944dd4b1c9aa46fb71b0fd4 /include
parent27ac905b8f88d28779b0661809286b5ba2817d37 (diff)
perf: Introduce pmu context switch callback
The callback is invoked when process is scheduled in or out. It provides mechanism for later patches to save/store the LBR stack. For the schedule in case, the callback is invoked at the same place that flush branch stack callback is invoked. So it also can replace the flush branch stack callback. To avoid unnecessary overhead, the callback is enabled only when there are events use the LBR stack. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Signed-off-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: eranian@google.com Cc: jolsa@redhat.com Link: http://lkml.kernel.org/r/1415156173-10035-3-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/perf_event.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 33262004c310..fbab6235d053 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -265,6 +265,13 @@ struct pmu {
265 * flush branch stack on context-switches (needed in cpu-wide mode) 265 * flush branch stack on context-switches (needed in cpu-wide mode)
266 */ 266 */
267 void (*flush_branch_stack) (void); 267 void (*flush_branch_stack) (void);
268
269 /*
270 * context-switches callback
271 */
272 void (*sched_task) (struct perf_event_context *ctx,
273 bool sched_in);
274
268}; 275};
269 276
270/** 277/**
@@ -558,6 +565,8 @@ extern void perf_event_delayed_put(struct task_struct *task);
558extern void perf_event_print_debug(void); 565extern void perf_event_print_debug(void);
559extern void perf_pmu_disable(struct pmu *pmu); 566extern void perf_pmu_disable(struct pmu *pmu);
560extern void perf_pmu_enable(struct pmu *pmu); 567extern void perf_pmu_enable(struct pmu *pmu);
568extern void perf_sched_cb_dec(struct pmu *pmu);
569extern void perf_sched_cb_inc(struct pmu *pmu);
561extern int perf_event_task_disable(void); 570extern int perf_event_task_disable(void);
562extern int perf_event_task_enable(void); 571extern int perf_event_task_enable(void);
563extern int perf_event_refresh(struct perf_event *event, int refresh); 572extern int perf_event_refresh(struct perf_event *event, int refresh);