[PATCH v2 0/3] Improve schedutil integration for FAIR tasks

From: Patrick Bellasi
Date: Fri May 11 2018 - 09:15:29 EST


Here is an update of:

https://lkml.org/lkml/2018/5/10/346

Where, apart from some minor clean-ups, I've added a cpufreq_enqueue() wrapper
function for cpufreq_update_util() to be used in enqueue_task_fair().
That's because:
- it helps to keep more clean the enqueue_task_fair()
by collecting all cpufreq related code into a single function
- it fixes the flags masking issue reported by Peter
- it allows to add a compilation guard for !SMP systems
where we never migrate tasks and thus we should never set the
SCHED_CPUFREQ_MIGRATION flag.

The SCHED_CPUFREQ_MIGRATION flag was previously set from update_load_avg()
which is empty defined for !SMP. Now that we update schedutil at the end of
enqueue_task_fair, we have to specifically address this case.

Still, the resulting code, it's more clean in defining when schedutil is going
to be updated and under which conditions/flags.

Again, I want to call out that with the last patch there is one function change
wrt mainline. When the CPU controller is in use, and a task is queued into a
throttled RQ, the behavior of the IOWAIT flag is different.
Currently we set the flag (and thus boost the frequency to max) even tough we
know the task is not going to run. With the patch the flag is not set, and thus
the frequency not bumped, which seems to most correct behavior to me.

Moreover, the IOWAIT flag for this task is lost forever, since when the RQ in
unthrottled we do not walk the tasks to collect their flags. However, given the
task has been already delayed because of the throttled RQ, perhaps a delayed
IOWAIT boost also does not make a lot of sense. What do you think?

Finally, Viresh suggested some patches could/should have "stable" in
Cc but I was not entirely sure. Thus, I've left it as a maintainers call.

Cheers Patrick

Changes in v2:
- improved comment in enqueue_task_fair (Peter)
- fixed flags masking (Peter)
- fixed !CONFIG_SMP build (0-DAY)
by using a cpufreq_enqueue wrapper to avoid setting the
SCHED_CPUFREQ_MIGRATION flag on !SMP systems
- removed blank lines (Viresh)
- add "Acked-by" Viresh tag to the first two patches

Patrick Bellasi (3):
sched/cpufreq: always consider blocked FAIR utilization
sched/fair: util_est: update before schedutil
sched/fair: schedutil: explicit update only when required

kernel/sched/cpufreq_schedutil.c | 17 ++++----
kernel/sched/fair.c | 93 +++++++++++++++++++++-------------------
2 files changed, 56 insertions(+), 54 deletions(-)

--
2.15.1