From dc08083babd97d93b7de850ab3a0abbc176a85e7 Mon Sep 17 00:00:00 2001 From: Ionela Voinescu Date: Thu, 7 Dec 2017 19:43:46 +0000 Subject: sched/fair: introduce minimum capacity capping sched feature We have the ability to track minimum capacity forced onto a CPU by userspace or external actors. This is provided though a minimum frequency scale factor exposed by arch_scale_min_freq_capacity. The use of this information is enabled through the MIN_CAPACITY_CAPPING feature. If not enabled, the minimum frequency scale factor will remain 0 and it will not impact energy estimation or scheduling decisions. Change-Id: Ibc61f2bf4fddf186695b72b262e602a6e8bfde37 Signed-off-by: Ionela Voinescu Signed-off-by: Chris Redpath --- kernel/sched/fair.c | 13 +++++++++++++ kernel/sched/features.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6b12c89315f6..8000639568c9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6486,6 +6486,19 @@ unsigned long capacity_curr_of(int cpu) #define EAS_CPU_BKP 2 #define EAS_CPU_CNT 3 +/* + * Returns the current capacity of cpu after applying both + * cpu and min freq scaling. + */ +unsigned long capacity_min_of(int cpu) +{ + if (!sched_feat(MIN_CAPACITY_CAPPING)) + return 0; + return arch_scale_cpu_capacity(NULL, cpu) * + arch_scale_min_freq_capacity(NULL, cpu) + >> SCHED_CAPACITY_SHIFT; +} + /* * energy_diff - supports the computation of the estimated energy impact in * moving a "task"'s "util_delta" between different CPU candidates. diff --git a/kernel/sched/features.h b/kernel/sched/features.h index c30c48fde7e6..3ad94cb2b4bf 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -78,3 +78,11 @@ SCHED_FEAT(ENERGY_AWARE, true) #else SCHED_FEAT(ENERGY_AWARE, false) #endif + +/* + * Minimum capacity capping. Keep track of minimum capacity factor when + * minimum frequency available to a policy is modified. + * If enabled, this can be used to inform the scheduler about capacity + * restrictions. + */ +SCHED_FEAT(MIN_CAPACITY_CAPPING, false) -- cgit v1.2.3