Re: [PATCH] sched: Introduce scaled capacity awareness in enqueue

From: Rohit Jain
Date: Wed May 31 2017 - 18:17:49 EST


On 05/30/2017 05:28 AM, Peter Zijlstra wrote:
On Mon, May 22, 2017 at 01:48:14PM -0700, Rohit Jain wrote:
The patch introduces capacity awarness in scheduler (CAS) which avoids
CPUs which might have their capacities reduced (due to IRQ/RT activity)
when trying to schedule threads (on the push side) in the system. This
awareness has been added into the fair scheduling class.

It does so by, using the following algorithm:
--------------------------------------------------------------------------
1) As in rt_avg the scaled capacities are already calculated.

2) This scaled capacity is normalized and mapped into buckets.
Why?

This is done to deterministically define the CPUs which are low on
capacities. By mapping it into buckets it becomes easier to do a
percentile calculation.

3) Any CPU which lies below the 80th percentile in terms of percentage
capacity available is considered as a low capacity CPU.
Random number; can we do better? What does existing code do?


Existing code checks to see if the waker is running on a CPU with better
capacity than the 'previous cpu'. If that is the case the waker cpu is
provided as 'target' to select_idle_sibling. (When I say capacity this
is not the scaled one because of IRQ, RT, etc.)

However, in case this 'target' is not an idle CPU, the rest of
select_idle_sibling would ignore the capacities altogether.