mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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>
This commit is contained in:
parent
8b1e13638d
commit
cb04ff9ac4
3 changed files with 17 additions and 30 deletions
|
@ -1084,10 +1084,8 @@ extern void perf_pmu_unregister(struct pmu *pmu);
|
|||
|
||||
extern int perf_num_counters(void);
|
||||
extern const char *perf_pmu_name(void);
|
||||
extern void __perf_event_task_sched_in(struct task_struct *prev,
|
||||
struct task_struct *task);
|
||||
extern void __perf_event_task_sched_out(struct task_struct *prev,
|
||||
struct task_struct *next);
|
||||
extern void __perf_event_task_sched(struct task_struct *prev,
|
||||
struct task_struct *next);
|
||||
extern int perf_event_init_task(struct task_struct *child);
|
||||
extern void perf_event_exit_task(struct task_struct *child);
|
||||
extern 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)
|
|||
|
||||
extern struct static_key_deferred perf_sched_events;
|
||||
|
||||
static inline void perf_event_task_sched_in(struct task_struct *prev,
|
||||
static inline void perf_event_task_sched(struct task_struct *prev,
|
||||
struct task_struct *task)
|
||||
{
|
||||
if (static_key_false(&perf_sched_events.key))
|
||||
__perf_event_task_sched_in(prev, task);
|
||||
}
|
||||
|
||||
static inline void perf_event_task_sched_out(struct task_struct *prev,
|
||||
struct task_struct *next)
|
||||
{
|
||||
perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
|
||||
|
||||
if (static_key_false(&perf_sched_events.key))
|
||||
__perf_event_task_sched_out(prev, next);
|
||||
__perf_event_task_sched(prev, task);
|
||||
}
|
||||
|
||||
extern void perf_event_mmap(struct vm_area_struct *vma);
|
||||
|
@ -1295,11 +1286,8 @@ extern void perf_event_disable(struct perf_event *event);
|
|||
extern void perf_event_task_tick(void);
|
||||
#else
|
||||
static inline void
|
||||
perf_event_task_sched_in(struct task_struct *prev,
|
||||
struct task_struct *task) { }
|
||||
static inline void
|
||||
perf_event_task_sched_out(struct task_struct *prev,
|
||||
struct task_struct *next) { }
|
||||
perf_event_task_sched(struct task_struct *prev,
|
||||
struct task_struct *task) { }
|
||||
static inline int perf_event_init_task(struct task_struct *child) { return 0; }
|
||||
static inline void perf_event_exit_task(struct task_struct *child) { }
|
||||
static inline void perf_event_free_task(struct task_struct *task) { }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue