Re: [RFC PATCH 2/6] sched/dl: Capacity-aware migrations

From: luca abeni
Date: Wed May 08 2019 - 04:19:05 EST


On Wed, 8 May 2019 10:04:36 +0200
Juri Lelli <juri.lelli@xxxxxxxxxx> wrote:

> Hi Luca,
>
> On 06/05/19 06:48, Luca Abeni wrote:
> > From: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
> >
> > Currently, the SCHED_DEADLINE scheduler uses a global EDF scheduling
> > algorithm, migrating tasks to CPU cores without considering the core
> > capacity and the task utilization. This works well on homogeneous
> > systems (SCHED_DEADLINE tasks are guaranteed to have a bounded
> > tardiness), but presents some issues on heterogeneous systems. For
> > example, a SCHED_DEADLINE task might be migrated on a core that has
> > not enough processing capacity to correctly serve the task (think
> > about a task with runtime 70ms and period 100ms migrated to a core
> > with processing capacity 0.5)
> >
> > This commit is a first step to address the issue: When a task wakes
> > up or migrates away from a CPU core, the scheduler tries to find an
> > idle core having enough processing capacity to serve the task.
> >
> > Signed-off-by: luca abeni <luca.abeni@xxxxxxxxxxxxxxx>
> > ---
> > kernel/sched/cpudeadline.c | 31 +++++++++++++++++++++++++++++--
> > kernel/sched/deadline.c | 8 ++++++--
> > kernel/sched/sched.h | 7 ++++++-
> > 3 files changed, 41 insertions(+), 5 deletions(-)
> >
> > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> > index 50316455ea66..d21f7905b9c1 100644
> > --- a/kernel/sched/cpudeadline.c
> > +++ b/kernel/sched/cpudeadline.c
> > @@ -110,6 +110,22 @@ static inline int cpudl_maximum(struct cpudl
> > *cp) return cp->elements[0].cpu;
> > }
> >
> > +static inline int dl_task_fit(const struct sched_dl_entity *dl_se,
> > + int cpu, u64 *c)
> > +{
> > + u64 cap = (arch_scale_cpu_capacity(NULL, cpu) *
> > arch_scale_freq_capacity(cpu)) >> SCHED_CAPACITY_SHIFT;
> > + s64 rel_deadline = dl_se->dl_deadline;
> > + u64 rem_runtime = dl_se->dl_runtime;
>
> This is not the dynamic remaining one, is it?

Right; I preferred to split this in two patches so that if we decide to
use only the static task parameters (dl_deadline and dl_runtime) I can
simply drop a patch ;-)


Luca

>
> I see however 4/6.. lemme better look at that.
>
> Best,
>
> - Juri