diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-12-19 17:04:55 -0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-12-19 17:04:55 -0800 |
| commit | 5a66e9b789aaaf58fa9ef91d83dd0e509f0eb624 (patch) | |
| tree | c10a62794297c2b3adf542d819f6642bc50b3ba0 /kernel | |
| parent | e26b0777dc92ab47d16b0134e57cd1c9e1083a9a (diff) | |
| parent | 92dc28458ccc3ab3aff715c77c744d0bdebd7506 (diff) | |
Merge "sched: Track average sleep time"
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/core.c | 4 | ||||
| -rw-r--r-- | kernel/sched/hmp.c | 14 | ||||
| -rw-r--r-- | kernel/sched/sched.h | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ca577a09ce5e..b70a76058b00 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2115,7 +2115,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) set_task_cpu(p, cpu); } - set_task_last_wake(p, wallclock); + note_task_waking(p, wallclock); #endif /* CONFIG_SMP */ ttwu_queue(p, cpu); stat: @@ -2184,7 +2184,7 @@ static void try_to_wake_up_local(struct task_struct *p) update_task_ravg(rq->curr, rq, TASK_UPDATE, wallclock, 0); update_task_ravg(p, rq, TASK_WAKE, wallclock, 0); ttwu_activate(rq, p, ENQUEUE_WAKEUP); - set_task_last_wake(p, wallclock); + note_task_waking(p, wallclock); } ttwu_do_wakeup(rq, p, 0); diff --git a/kernel/sched/hmp.c b/kernel/sched/hmp.c index 95e618ee1124..158fc748873b 100644 --- a/kernel/sched/hmp.c +++ b/kernel/sched/hmp.c @@ -74,11 +74,6 @@ inline void clear_ed_task(struct task_struct *p, struct rq *rq) rq->ed_task = NULL; } -inline void set_task_last_wake(struct task_struct *p, u64 wallclock) -{ - p->last_wake_ts = wallclock; -} - inline void set_task_last_switch_out(struct task_struct *p, u64 wallclock) { p->last_switch_out_ts = wallclock; @@ -1567,6 +1562,7 @@ void init_new_task_load(struct task_struct *p, bool idle_task) * the avg_burst to go below the threshold. */ p->ravg.avg_burst = 2 * (u64)sysctl_sched_short_burst; + p->ravg.avg_sleep_time = 0; p->ravg.curr_window_cpu = kcalloc(nr_cpu_ids, sizeof(u32), GFP_KERNEL); p->ravg.prev_window_cpu = kcalloc(nr_cpu_ids, sizeof(u32), GFP_KERNEL); @@ -4510,6 +4506,14 @@ void update_avg_burst(struct task_struct *p) p->ravg.curr_burst = 0; } +void note_task_waking(struct task_struct *p, u64 wallclock) +{ + u64 sleep_time = wallclock - p->last_switch_out_ts; + + p->last_wake_ts = wallclock; + update_avg(&p->ravg.avg_sleep_time, sleep_time); +} + #ifdef CONFIG_CGROUP_SCHED u64 cpu_upmigrate_discourage_read_u64(struct cgroup_subsys_state *css, struct cftype *cft) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ae7442007e8b..5f23462f3a60 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1120,7 +1120,7 @@ extern void mark_task_starting(struct task_struct *p); extern void set_window_start(struct rq *rq); extern void migrate_sync_cpu(int cpu, int new_cpu); extern void update_cluster_topology(void); -extern void set_task_last_wake(struct task_struct *p, u64 wallclock); +extern void note_task_waking(struct task_struct *p, u64 wallclock); extern void set_task_last_switch_out(struct task_struct *p, u64 wallclock); extern void init_clusters(void); extern int __init set_sched_enable_hmp(char *str); @@ -1518,7 +1518,7 @@ static inline void set_window_start(struct rq *rq) { } static inline void migrate_sync_cpu(int cpu, int new_cpu) {} static inline void init_clusters(void) {} static inline void update_cluster_topology(void) { } -static inline void set_task_last_wake(struct task_struct *p, u64 wallclock) { } +static inline void note_task_waking(struct task_struct *p, u64 wallclock) { } static inline void set_task_last_switch_out(struct task_struct *p, u64 wallclock) { } |
