Skip to content

Commit

Permalink
sched/fair: introduce minimum capacity capping sched feature
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ionela-voinescu authored and Quentin Perret committed Feb 1, 2018
1 parent 4f7837d commit 58b761f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions kernel/sched/fair.c
Expand Up @@ -5424,6 +5424,20 @@ unsigned long capacity_curr_of(int cpu)
>> SCHED_CAPACITY_SHIFT;
}

/*
* 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;
}


static inline bool energy_aware(void)
{
return sched_feat(ENERGY_AWARE);
Expand Down
8 changes: 8 additions & 0 deletions kernel/sched/features.h
Expand Up @@ -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)

0 comments on commit 58b761f

Please sign in to comment.