diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-08-26 22:22:38 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-08-26 22:22:38 -0700 |
| commit | 1b7819036eaa2ba0c93bcc65fbbc1e72fa9b824a (patch) | |
| tree | a08a77e7e4a5c5bd332a7a98637516dd65b217d3 /include | |
| parent | 373c6ba99fddd8071aa8eebd889c73426760fa3c (diff) | |
| parent | 2552980f79e476b99d9f489c265a836dd61a2102 (diff) | |
Merge "sched: handle frequency alert notifications better"
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/sched.h | 120 | ||||
| -rw-r--r-- | include/linux/sched/sysctl.h | 18 | ||||
| -rw-r--r-- | include/trace/events/sched.h | 68 |
3 files changed, 83 insertions, 123 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 06dd540192c7..74b2a11b1d1c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1232,9 +1232,6 @@ struct sched_avg { u64 last_update_time, load_sum; u32 util_sum, period_contrib; unsigned long load_avg, util_avg; -#ifdef CONFIG_SCHED_HMP - u32 runnable_avg_sum_scaled; -#endif }; #ifdef CONFIG_SCHEDSTATS @@ -1308,12 +1305,10 @@ struct ravg { u64 mark_start; u32 sum, demand; u32 sum_history[RAVG_HIST_SIZE_MAX]; -#ifdef CONFIG_SCHED_FREQ_INPUT u32 curr_window, prev_window; u16 active_windows; u32 pred_demand; u8 busy_buckets[NUM_BUSY_BUCKETS]; -#endif }; struct sched_entity { @@ -2155,32 +2150,6 @@ static inline cputime_t task_gtime(struct task_struct *t) extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st); -struct sched_load { - unsigned long prev_load; - unsigned long new_task_load; - unsigned long predicted_load; -}; - -#if defined(CONFIG_SCHED_FREQ_INPUT) -extern int sched_set_window(u64 window_start, unsigned int window_size); -extern unsigned long sched_get_busy(int cpu); -extern void sched_get_cpus_busy(struct sched_load *busy, - const struct cpumask *query_cpus); -extern void sched_set_io_is_busy(int val); -#else -static inline int sched_set_window(u64 window_start, unsigned int window_size) -{ - return -EINVAL; -} -static inline unsigned long sched_get_busy(int cpu) -{ - return 0; -} -static inline void sched_get_cpus_busy(struct sched_load *busy, - const struct cpumask *query_cpus) {}; -static inline void sched_set_io_is_busy(int val) {}; -#endif - /* * Per process flags */ @@ -2349,10 +2318,6 @@ extern void do_set_cpus_allowed(struct task_struct *p, extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask); -extern void sched_set_cpu_cstate(int cpu, int cstate, - int wakeup_energy, int wakeup_latency); -extern void sched_set_cluster_dstate(const cpumask_t *cluster_cpus, int dstate, - int wakeup_energy, int wakeup_latency); #else static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) @@ -2365,24 +2330,27 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p, return -EINVAL; return 0; } -static inline void -sched_set_cpu_cstate(int cpu, int cstate, int wakeup_energy, int wakeup_latency) -{ -} - -static inline void sched_set_cluster_dstate(const cpumask_t *cluster_cpus, - int dstate, int wakeup_energy, int wakeup_latency) -{ -} #endif +struct sched_load { + unsigned long prev_load; + unsigned long new_task_load; + unsigned long predicted_load; +}; + extern int sched_set_wake_up_idle(struct task_struct *p, int wake_up_idle); extern u32 sched_get_wake_up_idle(struct task_struct *p); -extern int sched_set_group_id(struct task_struct *p, unsigned int group_id); -extern unsigned int sched_get_group_id(struct task_struct *p); -#ifdef CONFIG_SCHED_HMP +struct cpu_cycle_counter_cb { + u64 (*get_cpu_cycle_counter)(int cpu); +}; +#ifdef CONFIG_SCHED_HMP +extern int sched_set_window(u64 window_start, unsigned int window_size); +extern unsigned long sched_get_busy(int cpu); +extern void sched_get_cpus_busy(struct sched_load *busy, + const struct cpumask *query_cpus); +extern void sched_set_io_is_busy(int val); extern int sched_set_boost(int enable); extern int sched_set_init_task_load(struct task_struct *p, int init_load_pct); extern u32 sched_get_init_task_load(struct task_struct *p); @@ -2391,9 +2359,42 @@ extern unsigned int sched_get_static_cpu_pwr_cost(int cpu); extern int sched_set_static_cluster_pwr_cost(int cpu, unsigned int cost); extern unsigned int sched_get_static_cluster_pwr_cost(int cpu); extern int sched_update_freq_max_load(const cpumask_t *cpumask); -extern void sched_update_cpu_freq_min_max(const cpumask_t *cpus, u32 fmin, u32 - fmax); -#else +extern void sched_update_cpu_freq_min_max(const cpumask_t *cpus, + u32 fmin, u32 fmax); +extern void sched_set_cpu_cstate(int cpu, int cstate, + int wakeup_energy, int wakeup_latency); +extern void sched_set_cluster_dstate(const cpumask_t *cluster_cpus, int dstate, + int wakeup_energy, int wakeup_latency); +extern int register_cpu_cycle_counter_cb(struct cpu_cycle_counter_cb *cb); +extern u64 sched_ktime_clock(void); +extern int sched_set_group_id(struct task_struct *p, unsigned int group_id); +extern unsigned int sched_get_group_id(struct task_struct *p); + +#else /* CONFIG_SCHED_HMP */ +static inline u64 sched_ktime_clock(void) +{ + return 0; +} + +static inline int +register_cpu_cycle_counter_cb(struct cpu_cycle_counter_cb *cb) +{ + return 0; +} + +static inline int sched_set_window(u64 window_start, unsigned int window_size) +{ + return -EINVAL; +} +static inline unsigned long sched_get_busy(int cpu) +{ + return 0; +} +static inline void sched_get_cpus_busy(struct sched_load *busy, + const struct cpumask *query_cpus) {}; + +static inline void sched_set_io_is_busy(int val) {}; + static inline int sched_set_boost(int enable) { return -EINVAL; @@ -2406,7 +2407,17 @@ static inline int sched_update_freq_max_load(const cpumask_t *cpumask) static inline void sched_update_cpu_freq_min_max(const cpumask_t *cpus, u32 fmin, u32 fmax) { } -#endif + +static inline void +sched_set_cpu_cstate(int cpu, int cstate, int wakeup_energy, int wakeup_latency) +{ +} + +static inline void sched_set_cluster_dstate(const cpumask_t *cluster_cpus, + int dstate, int wakeup_energy, int wakeup_latency) +{ +} +#endif /* CONFIG_SCHED_HMP */ #ifdef CONFIG_NO_HZ_COMMON void calc_load_enter_idle(void); @@ -2441,8 +2452,6 @@ extern u64 local_clock(void); extern u64 running_clock(void); extern u64 sched_clock_cpu(int cpu); -extern u64 sched_ktime_clock(void); - extern void sched_clock_init(void); extern int sched_clock_initialized(void); @@ -3379,9 +3388,4 @@ static inline unsigned long rlimit_max(unsigned int limit) return task_rlimit_max(current, limit); } -struct cpu_cycle_counter_cb { - u64 (*get_cpu_cycle_counter)(int cpu); -}; -int register_cpu_cycle_counter_cb(struct cpu_cycle_counter_cb *cb); - #endif diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 3e5fd5619367..68a9bdde6604 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -40,21 +40,14 @@ extern unsigned int sysctl_sched_min_granularity; extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_child_runs_first; extern unsigned int sysctl_sched_wake_to_idle; -extern unsigned int sysctl_sched_wakeup_load_threshold; + +#ifdef CONFIG_SCHED_HMP +extern int sysctl_sched_freq_inc_notify; +extern int sysctl_sched_freq_dec_notify; extern unsigned int sysctl_sched_window_stats_policy; extern unsigned int sysctl_sched_ravg_hist_size; extern unsigned int sysctl_sched_cpu_high_irqload; - -#if defined(CONFIG_SCHED_FREQ_INPUT) || defined(CONFIG_SCHED_HMP) extern unsigned int sysctl_sched_init_task_load_pct; -#endif - -#ifdef CONFIG_SCHED_FREQ_INPUT -extern int sysctl_sched_freq_inc_notify; -extern int sysctl_sched_freq_dec_notify; -#endif - -#ifdef CONFIG_SCHED_HMP extern unsigned int sysctl_sched_spill_nr_run; extern unsigned int sysctl_sched_spill_load_pct; extern unsigned int sysctl_sched_upmigrate_pct; @@ -66,11 +59,10 @@ extern unsigned int sysctl_sched_big_waker_task_load_pct; extern unsigned int sysctl_sched_select_prev_cpu_us; extern unsigned int sysctl_sched_enable_colocation; extern unsigned int sysctl_sched_restrict_cluster_spill; -#if defined(CONFIG_SCHED_FREQ_INPUT) extern unsigned int sysctl_sched_new_task_windows; extern unsigned int sysctl_sched_pred_alert_freq; extern unsigned int sysctl_sched_freq_aggregate; -#endif +extern unsigned int sysctl_sched_enable_thread_grouping; #else /* CONFIG_SCHED_HMP */ diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 2c69b5a3c2f4..f35630045c2f 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -76,10 +76,8 @@ TRACE_EVENT(sched_enq_deq_task, __field(unsigned int, cpus_allowed ) #ifdef CONFIG_SCHED_HMP __field(unsigned int, demand ) -#ifdef CONFIG_SCHED_FREQ_INPUT __field(unsigned int, pred_demand ) #endif -#endif ), TP_fast_assign( @@ -94,18 +92,13 @@ TRACE_EVENT(sched_enq_deq_task, __entry->cpus_allowed = cpus_allowed; #ifdef CONFIG_SCHED_HMP __entry->demand = p->ravg.demand; -#ifdef CONFIG_SCHED_FREQ_INPUT __entry->pred_demand = p->ravg.pred_demand; #endif -#endif ), TP_printk("cpu=%d %s comm=%s pid=%d prio=%d nr_running=%u cpu_load=%lu rt_nr_running=%u affine=%x" #ifdef CONFIG_SCHED_HMP - " demand=%u" -#ifdef CONFIG_SCHED_FREQ_INPUT - " pred_demand=%u" -#endif + " demand=%u pred_demand=%u" #endif , __entry->cpu, __entry->enqueue ? "enqueue" : "dequeue", @@ -113,10 +106,7 @@ TRACE_EVENT(sched_enq_deq_task, __entry->prio, __entry->nr_running, __entry->cpu_load, __entry->rt_nr_running, __entry->cpus_allowed #ifdef CONFIG_SCHED_HMP - , __entry->demand -#ifdef CONFIG_SCHED_FREQ_INPUT - , __entry->pred_demand -#endif + , __entry->demand, __entry->pred_demand #endif ) ); @@ -126,9 +116,9 @@ TRACE_EVENT(sched_enq_deq_task, TRACE_EVENT(sched_task_load, TP_PROTO(struct task_struct *p, bool boost, int reason, - bool sync, bool need_idle, bool fast_path, int best_cpu), + bool sync, bool need_idle, u32 flags, int best_cpu), - TP_ARGS(p, boost, reason, sync, need_idle, fast_path, best_cpu), + TP_ARGS(p, boost, reason, sync, need_idle, flags, best_cpu), TP_STRUCT__entry( __array( char, comm, TASK_COMM_LEN ) @@ -138,7 +128,7 @@ TRACE_EVENT(sched_task_load, __field( int, reason ) __field( bool, sync ) __field( bool, need_idle ) - __field( bool, fast_path ) + __field( u32, flags ) __field( int, best_cpu ) __field( u64, latency ) ), @@ -151,17 +141,17 @@ TRACE_EVENT(sched_task_load, __entry->reason = reason; __entry->sync = sync; __entry->need_idle = need_idle; - __entry->fast_path = fast_path; + __entry->flags = flags; __entry->best_cpu = best_cpu; __entry->latency = p->state == TASK_WAKING ? sched_ktime_clock() - p->ravg.mark_start : 0; ), - TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d fast_path=%d best_cpu=%d latency=%llu", + TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d flags=%x best_cpu=%d latency=%llu", __entry->pid, __entry->comm, __entry->demand, __entry->boost, __entry->reason, __entry->sync, - __entry->need_idle, __entry->fast_path, + __entry->need_idle, __entry->flags, __entry->best_cpu, __entry->latency) ); @@ -291,7 +281,6 @@ TRACE_EVENT(sched_update_task_ravg, __field(unsigned int, demand ) __field(unsigned int, sum ) __field( int, cpu ) -#ifdef CONFIG_SCHED_FREQ_INPUT __field(unsigned int, pred_demand ) __field( u64, rq_cs ) __field( u64, rq_ps ) @@ -304,7 +293,6 @@ TRACE_EVENT(sched_update_task_ravg, __field( u64, nt_cs ) __field( u64, nt_ps ) __field( u32, active_windows ) -#endif ), TP_fast_assign( @@ -322,7 +310,6 @@ TRACE_EVENT(sched_update_task_ravg, __entry->demand = p->ravg.demand; __entry->sum = p->ravg.sum; __entry->irqtime = irqtime; -#ifdef CONFIG_SCHED_FREQ_INPUT __entry->pred_demand = p->ravg.pred_demand; __entry->rq_cs = rq->curr_runnable_sum; __entry->rq_ps = rq->prev_runnable_sum; @@ -335,28 +322,19 @@ TRACE_EVENT(sched_update_task_ravg, __entry->nt_cs = rq->nt_curr_runnable_sum; __entry->nt_ps = rq->nt_prev_runnable_sum; __entry->active_windows = p->ravg.active_windows; -#endif ), - TP_printk("wc %llu ws %llu delta %llu event %s cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u sum %u irqtime %llu" -#ifdef CONFIG_SCHED_FREQ_INPUT - " pred_demand %u rq_cs %llu rq_ps %llu cur_window %u prev_window %u nt_cs %llu nt_ps %llu active_wins %u grp_cs %lld grp_ps %lld, grp_nt_cs %llu, grp_nt_ps: %llu" -#endif + TP_printk("wc %llu ws %llu delta %llu event %s cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u sum %u irqtime %llu pred_demand %u rq_cs %llu rq_ps %llu cur_window %u prev_window %u nt_cs %llu nt_ps %llu active_wins %u grp_cs %lld grp_ps %lld, grp_nt_cs %llu, grp_nt_ps: %llu" , __entry->wallclock, __entry->win_start, __entry->delta, task_event_names[__entry->evt], __entry->cpu, __entry->cur_freq, __entry->cur_pid, __entry->pid, __entry->comm, __entry->mark_start, __entry->delta_m, __entry->demand, - __entry->sum, __entry->irqtime -#ifdef CONFIG_SCHED_FREQ_INPUT - , __entry->pred_demand, __entry->rq_cs, __entry->rq_ps, - __entry->curr_window, __entry->prev_window, - __entry->nt_cs, __entry->nt_ps, - __entry->active_windows, - __entry->grp_cs, __entry->grp_ps, - __entry->grp_nt_cs, __entry->grp_nt_ps -#endif - ) + __entry->sum, __entry->irqtime, __entry->pred_demand, + __entry->rq_cs, __entry->rq_ps, __entry->curr_window, + __entry->prev_window, __entry->nt_cs, __entry->nt_ps, + __entry->active_windows, __entry->grp_cs, + __entry->grp_ps, __entry->grp_nt_cs, __entry->grp_nt_ps) ); TRACE_EVENT(sched_get_task_cpu_cycles, @@ -402,9 +380,7 @@ TRACE_EVENT(sched_update_history, __field( int, samples ) __field(enum task_event, evt ) __field(unsigned int, demand ) -#ifdef CONFIG_SCHED_FREQ_INPUT __field(unsigned int, pred_demand ) -#endif __array( u32, hist, RAVG_HIST_SIZE_MAX) __field(unsigned int, nr_big_tasks ) __field( int, cpu ) @@ -417,27 +393,19 @@ TRACE_EVENT(sched_update_history, __entry->samples = samples; __entry->evt = evt; __entry->demand = p->ravg.demand; -#ifdef CONFIG_SCHED_FREQ_INPUT __entry->pred_demand = p->ravg.pred_demand; -#endif memcpy(__entry->hist, p->ravg.sum_history, RAVG_HIST_SIZE_MAX * sizeof(u32)); __entry->nr_big_tasks = rq->hmp_stats.nr_big_tasks; __entry->cpu = rq->cpu; ), - TP_printk("%d (%s): runtime %u samples %d event %s demand %u" -#ifdef CONFIG_SCHED_FREQ_INPUT - " pred_demand %u" -#endif + TP_printk("%d (%s): runtime %u samples %d event %s demand %u pred_demand %u" " (hist: %u %u %u %u %u) cpu %d nr_big %u", __entry->pid, __entry->comm, __entry->runtime, __entry->samples, task_event_names[__entry->evt], - __entry->demand, -#ifdef CONFIG_SCHED_FREQ_INPUT - __entry->pred_demand, -#endif + __entry->demand, __entry->pred_demand, __entry->hist[0], __entry->hist[1], __entry->hist[2], __entry->hist[3], __entry->hist[4], __entry->cpu, __entry->nr_big_tasks) @@ -476,8 +444,6 @@ TRACE_EVENT(sched_reset_all_window_stats, __entry->old_val, __entry->new_val) ); -#ifdef CONFIG_SCHED_FREQ_INPUT - TRACE_EVENT(sched_update_pred_demand, TP_PROTO(struct rq *rq, struct task_struct *p, u32 runtime, int pct, @@ -637,8 +603,6 @@ TRACE_EVENT(sched_freq_alert, __entry->old_pred, __entry->new_pred) ); -#endif /* CONFIG_SCHED_FREQ_INPUT */ - #endif /* CONFIG_SCHED_HMP */ /* |
