summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonela Voinescu <ionela.voinescu@arm.com>2017-12-07 19:43:46 +0000
committerGeorg Veichtlbauer <georg@vware.at>2023-07-26 21:01:08 +0200
commitdc08083babd97d93b7de850ab3a0abbc176a85e7 (patch)
tree1807b410fed4580d56973193737e38d4d4670681
parent40bf84fc323affcca8b3d446d9cecef706a7a36b (diff)
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 <ionela.voinescu@arm.com> Signed-off-by: Chris Redpath <chris.redpath@arm.com>
-rw-r--r--kernel/sched/fair.c13
-rw-r--r--kernel/sched/features.h8
2 files changed, 21 insertions, 0 deletions
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
@@ -6487,6 +6487,19 @@ unsigned long capacity_curr_of(int cpu)
#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)