diff options
author | Pavankumar Kondeti <pkondeti@codeaurora.org> | 2017-05-11 10:30:35 +0530 |
---|---|---|
committer | Pavankumar Kondeti <pkondeti@codeaurora.org> | 2017-05-31 08:30:01 +0530 |
commit | f37f0680d728df428d75278597402c53b34366b0 (patch) | |
tree | 62b0e5cd93b9ee0a4865964f58188d6c7eda917a /kernel | |
parent | 350f6ac81713d53ee0447b8a17249efef75405d2 (diff) |
sched: Improve short sleeping tasks detection
When a short sleeping task goes for a long sleep, the task's
avg_sleep_time signal gets boosted. This signal will not go
below short_sleep threshold for a long time time even when the
task run in short bursts. This results in frequent preemption
of other tasks as the short burst tasks are placed on busy CPUs.
The idea behind tracking avg_sleep_time signal is to detect if a
task is short sleeping or not. Limit the sleep time to twice the
short sleep threshold to make avg_sleep_time signal more responsive.
This won't affect regular long sleeping tasks, as the avg_sleep_time
would be higher than threshold.
Change-Id: Ic0838e81ef7f5d83864a58b318553afc42812853
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/hmp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/sched/hmp.c b/kernel/sched/hmp.c index df47c26ab6d2..0591975de3bf 100644 --- a/kernel/sched/hmp.c +++ b/kernel/sched/hmp.c @@ -4303,8 +4303,20 @@ void note_task_waking(struct task_struct *p, u64 wallclock) { u64 sleep_time = wallclock - p->last_switch_out_ts; - p->last_wake_ts = wallclock; + /* + * When a short burst and short sleeping task goes for a long + * sleep, the task's avg_sleep_time gets boosted. It will not + * come below short_sleep threshold for a lot of time and it + * results in incorrect packing. The idead behind tracking + * avg_sleep_time is to detect if a task is short sleeping + * or not. So limit the sleep time to twice the short sleep + * threshold. For regular long sleeping tasks, the avg_sleep_time + * would be higher than threshold, and packing happens correctly. + */ + sleep_time = min_t(u64, sleep_time, 2 * sysctl_sched_short_sleep); update_avg(&p->ravg.avg_sleep_time, sleep_time); + + p->last_wake_ts = wallclock; } #ifdef CONFIG_CGROUP_SCHED |