Loading include/linux/sched.h +1 −1 Original line number Diff line number Diff line Loading @@ -1719,8 +1719,8 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, extern int task_free_register(struct notifier_block *n); extern int task_free_unregister(struct notifier_block *n); extern int sched_set_window(u64 window_start, unsigned int window_size); static inline void sched_set_io_is_busy(int val) {}; extern unsigned long sched_get_busy(int cpu); extern void sched_set_io_is_busy(int val); /* * Per process flags Loading kernel/sched/core.c +39 −8 Original line number Diff line number Diff line Loading @@ -1136,6 +1136,7 @@ unsigned int min_possible_efficiency = 1024; __read_mostly int sysctl_sched_freq_inc_notify_slack_pct; __read_mostly int sysctl_sched_freq_dec_notify_slack_pct = 25; static __read_mostly unsigned int sched_account_wait_time = 1; static __read_mostly unsigned int sched_io_is_busy; /* * Maximum possible frequency across all cpus. Task demand and cpu Loading Loading @@ -1301,6 +1302,14 @@ static int __init set_sched_ravg_window(char *str) early_param("sched_ravg_window", set_sched_ravg_window); static inline int cpu_is_waiting_on_io(struct rq *rq) { if (!sched_io_is_busy) return 0; return atomic_read(&rq->nr_iowait); } static inline void move_window_start(struct rq *rq, u64 wallclock, int update_sum, struct task_struct *p) Loading @@ -1316,7 +1325,7 @@ move_window_start(struct rq *rq, u64 wallclock, int update_sum, nr_windows = div64_u64(delta, sched_ravg_window); rq->window_start += (u64)nr_windows * (u64)sched_ravg_window; if (is_idle_task(rq->curr)) { if (is_idle_task(rq->curr) && !cpu_is_waiting_on_io(rq)) { if (nr_windows == 1) rq->prev_runnable_sum = rq->curr_runnable_sum; else Loading Loading @@ -1372,6 +1381,7 @@ static void update_task_ravg(struct task_struct *p, struct rq *rq, int update_sum, new_window; u64 mark_start = p->ravg.mark_start; u64 window_start; s64 delta = 0; if (sched_use_pelt || !rq->window_start) return; Loading @@ -1385,15 +1395,30 @@ static void update_task_ravg(struct task_struct *p, struct rq *rq, move_window_start(rq, wallclock, update_sum, p); window_start = rq->window_start; /* * Don't bother accounting for idle task, also we would not want * to attribute its time to the aggregate RQ busy time */ if (is_idle_task(p)) return; if (is_idle_task(p)) { if (!(event == PUT_PREV_TASK && cpu_is_waiting_on_io(rq))) goto done; if (window_start > mark_start) { delta = window_start - mark_start; if (delta > window_size) { rq->curr_runnable_sum = 0; delta = window_size; } delta = scale_exec_time(delta, rq); rq->curr_runnable_sum += delta; rq->prev_runnable_sum = rq->curr_runnable_sum; rq->curr_runnable_sum = 0; mark_start = window_start; } delta = wallclock - mark_start; delta = scale_exec_time(delta, rq); rq->curr_runnable_sum += delta; goto done; } do { s64 delta = 0; int nr_full_windows = 0; u64 now = wallclock; u32 sum = 0; Loading Loading @@ -1473,6 +1498,7 @@ static void update_task_ravg(struct task_struct *p, struct rq *rq, } } done: trace_sched_update_task_ravg(p, rq, event, wallclock); p->ravg.mark_start = wallclock; Loading Loading @@ -1630,6 +1656,11 @@ void reset_all_window_stats(u64 window_start, unsigned int window_size, } } void sched_set_io_is_busy(int val) { sched_io_is_busy = val; } int sched_set_window(u64 window_start, unsigned int window_size) { u64 ws, now; Loading Loading
include/linux/sched.h +1 −1 Original line number Diff line number Diff line Loading @@ -1719,8 +1719,8 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, extern int task_free_register(struct notifier_block *n); extern int task_free_unregister(struct notifier_block *n); extern int sched_set_window(u64 window_start, unsigned int window_size); static inline void sched_set_io_is_busy(int val) {}; extern unsigned long sched_get_busy(int cpu); extern void sched_set_io_is_busy(int val); /* * Per process flags Loading
kernel/sched/core.c +39 −8 Original line number Diff line number Diff line Loading @@ -1136,6 +1136,7 @@ unsigned int min_possible_efficiency = 1024; __read_mostly int sysctl_sched_freq_inc_notify_slack_pct; __read_mostly int sysctl_sched_freq_dec_notify_slack_pct = 25; static __read_mostly unsigned int sched_account_wait_time = 1; static __read_mostly unsigned int sched_io_is_busy; /* * Maximum possible frequency across all cpus. Task demand and cpu Loading Loading @@ -1301,6 +1302,14 @@ static int __init set_sched_ravg_window(char *str) early_param("sched_ravg_window", set_sched_ravg_window); static inline int cpu_is_waiting_on_io(struct rq *rq) { if (!sched_io_is_busy) return 0; return atomic_read(&rq->nr_iowait); } static inline void move_window_start(struct rq *rq, u64 wallclock, int update_sum, struct task_struct *p) Loading @@ -1316,7 +1325,7 @@ move_window_start(struct rq *rq, u64 wallclock, int update_sum, nr_windows = div64_u64(delta, sched_ravg_window); rq->window_start += (u64)nr_windows * (u64)sched_ravg_window; if (is_idle_task(rq->curr)) { if (is_idle_task(rq->curr) && !cpu_is_waiting_on_io(rq)) { if (nr_windows == 1) rq->prev_runnable_sum = rq->curr_runnable_sum; else Loading Loading @@ -1372,6 +1381,7 @@ static void update_task_ravg(struct task_struct *p, struct rq *rq, int update_sum, new_window; u64 mark_start = p->ravg.mark_start; u64 window_start; s64 delta = 0; if (sched_use_pelt || !rq->window_start) return; Loading @@ -1385,15 +1395,30 @@ static void update_task_ravg(struct task_struct *p, struct rq *rq, move_window_start(rq, wallclock, update_sum, p); window_start = rq->window_start; /* * Don't bother accounting for idle task, also we would not want * to attribute its time to the aggregate RQ busy time */ if (is_idle_task(p)) return; if (is_idle_task(p)) { if (!(event == PUT_PREV_TASK && cpu_is_waiting_on_io(rq))) goto done; if (window_start > mark_start) { delta = window_start - mark_start; if (delta > window_size) { rq->curr_runnable_sum = 0; delta = window_size; } delta = scale_exec_time(delta, rq); rq->curr_runnable_sum += delta; rq->prev_runnable_sum = rq->curr_runnable_sum; rq->curr_runnable_sum = 0; mark_start = window_start; } delta = wallclock - mark_start; delta = scale_exec_time(delta, rq); rq->curr_runnable_sum += delta; goto done; } do { s64 delta = 0; int nr_full_windows = 0; u64 now = wallclock; u32 sum = 0; Loading Loading @@ -1473,6 +1498,7 @@ static void update_task_ravg(struct task_struct *p, struct rq *rq, } } done: trace_sched_update_task_ravg(p, rq, event, wallclock); p->ravg.mark_start = wallclock; Loading Loading @@ -1630,6 +1656,11 @@ void reset_all_window_stats(u64 window_start, unsigned int window_size, } } void sched_set_io_is_busy(int val) { sched_io_is_busy = val; } int sched_set_window(u64 window_start, unsigned int window_size) { u64 ws, now; Loading