From: luca abeni <luca.abeni@santannapisa.it>
To: Quentin Perret <quentin.perret@arm.com>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
"Paul E . McKenney" <paulmck@linux.ibm.com>,
Joel Fernandes <joel@joelfernandes.org>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
Morten Rasmussen <morten.rasmussen@arm.com>,
Juri Lelli <juri.lelli@redhat.com>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Patrick Bellasi <patrick.bellasi@arm.com>,
Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>
Subject: Re: [RFC PATCH 6/6] sched/dl: Try not to select a too fast core
Date: Wed, 8 May 2019 08:26:05 +0200 [thread overview]
Message-ID: <20190508082605.623ed4d5@nowhere> (raw)
In-Reply-To: <20190507155732.7ravrnld54rb6k5a@queper01-lin>
Hi Quentin,
On Tue, 7 May 2019 16:57:34 +0100
Quentin Perret <quentin.perret@arm.com> wrote:
> On Monday 06 May 2019 at 06:48:36 (+0200), Luca Abeni wrote:
> > From: luca abeni <luca.abeni@santannapisa.it>
> >
> > When a task can fit on multiple CPU cores, try to select the slowest
> > core that is able to properly serve the task. This avoids useless
> > future migrations, leaving the "fast cores" idle for more
> > heavyweight tasks.
>
> But only if the _current_ capacity of big CPUs (at the current freq)
> is higher than the current capacity of the littles, is that right ?
> So we don't really have a guarantee to pack small tasks on little
> cores ...
Yes, the capacity is estimated at the current frequency, so this is a
potential problem.
> What is the rationale for looking at the current freq in
> dl_task_fit() ?
Mainly two reasons: the first one is to try to reduce frequency
switches (I did not perform measurements on the hikey960, I remember
that on other CPUs a frequency switch can take a considerable amount of
time).
Then, I wanted to have a mechanism that can work with all the possible
cpufreq governors... So, I did not assume that the frequency can change
(for example, I remember that without considering the current
frequency I had issues when using the "userspace" governor).
Maybe I just do not know this kernel subsystem well enough, but I did
not find any way to know the maximum frequency that the current
governor can set (I mean, I found a "maximum frequency" field that
tells me the maximum frequency that the cpufreq driver can set, but I
do not know if the governor will be able to set it --- again, consider
the "userspace" governor).
If there is a way to know this value, then I can use it for checking if
a task can fit in a core.
Thanks,
Luca
> Energy reasons ? If so, I'd argue you should look at
> the energy model to break the tie between CPU candidates ... ;)
>
> And in the mean time, you could just look at arch_scale_cpu_capacity()
> to check if a task fits ?
>
> > Signed-off-by: luca abeni <luca.abeni@santannapisa.it>
> > ---
> > kernel/sched/cpudeadline.c | 17 ++++++++++++-----
> > 1 file changed, 12 insertions(+), 5 deletions(-)
> >
> > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> > index 2a4ac7b529b7..897ed71af515 100644
> > --- a/kernel/sched/cpudeadline.c
> > +++ b/kernel/sched/cpudeadline.c
> > @@ -143,17 +143,24 @@ int cpudl_find(struct cpudl *cp, struct
> > task_struct *p, struct cpumask *later_mask)
> > {
> > const struct sched_dl_entity *dl_se = &p->dl;
> > + struct cpumask tmp_mask;
>
> Hmm, these can get pretty big, so not sure about having one on the
> stack ...
>
> >
> > if (later_mask &&
> > - cpumask_and(later_mask, cp->free_cpus,
> > &p->cpus_allowed)) {
> > + cpumask_and(&tmp_mask, cp->free_cpus,
> > &p->cpus_allowed)) { int cpu, max_cpu = -1;
> > - u64 max_cap = 0;
> > + u64 max_cap = 0, min_cap = SCHED_CAPACITY_SCALE *
> > SCHED_CAPACITY_SCALE;
> > - for_each_cpu(cpu, later_mask) {
> > + cpumask_clear(later_mask);
> > + for_each_cpu(cpu, &tmp_mask) {
> > u64 cap;
> >
> > - if (!dl_task_fit(&p->dl, cpu, &cap))
> > - cpumask_clear_cpu(cpu, later_mask);
> > + if (dl_task_fit(&p->dl, cpu, &cap) && (cap
> > <= min_cap)) {
> > + if (cap < min_cap) {
> > + min_cap = cap;
> > + cpumask_clear(later_mask);
> > + }
> > + cpumask_set_cpu(cpu, later_mask);
> > + }
> >
> > if (cap > max_cap) {
> > max_cap = cap;
> > --
> > 2.20.1
> >
>
> Thanks,
> Quentin
next prev parent reply other threads:[~2019-05-08 6:26 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-06 4:48 [RFC PATCH 0/6] Capacity awareness for SCHED_DEADLINE Luca Abeni
2019-05-06 4:48 ` [RFC PATCH 1/6] sched/dl: Improve deadline admission control for asymmetric CPU capacities Luca Abeni
2019-05-07 13:48 ` Quentin Perret
2019-05-07 13:55 ` Vincent Guittot
2019-05-07 14:02 ` Quentin Perret
2019-05-07 14:25 ` luca abeni
2019-05-07 14:31 ` Quentin Perret
2019-05-07 14:43 ` luca abeni
2019-07-08 11:22 ` Dietmar Eggemann
2019-07-08 15:05 ` Quentin Perret
2019-06-18 16:41 ` Alessio Balsini
2019-05-06 4:48 ` [RFC PATCH 2/6] sched/dl: Capacity-aware migrations Luca Abeni
2019-05-07 13:35 ` Quentin Perret
2019-05-07 14:17 ` luca abeni
2019-05-07 15:04 ` Quentin Perret
2019-05-07 14:10 ` Quentin Perret
2019-05-07 14:41 ` luca abeni
2019-05-07 15:02 ` Quentin Perret
2019-05-08 8:04 ` Juri Lelli
2019-05-08 8:17 ` luca abeni
2019-07-04 12:05 ` Dietmar Eggemann
2019-07-08 7:41 ` luca abeni
2019-07-08 10:41 ` Dietmar Eggemann
2019-05-06 4:48 ` [RFC PATCH 3/6] sched/dl: Try better placement even for deadline tasks that do not block Luca Abeni
2019-05-07 14:13 ` Quentin Perret
2019-05-07 16:00 ` Morten Rasmussen
2019-05-08 8:01 ` Juri Lelli
2019-05-08 8:14 ` luca abeni
2019-05-08 9:22 ` Juri Lelli
2019-07-08 13:55 ` Peter Zijlstra
2019-07-09 13:24 ` luca abeni
2019-07-09 13:42 ` Peter Zijlstra
2019-07-11 11:17 ` Dietmar Eggemann
2019-07-11 12:00 ` Peter Zijlstra
2019-07-11 15:33 ` Dietmar Eggemann
2019-07-09 14:44 ` Dietmar Eggemann
2019-05-06 4:48 ` [RFC PATCH 4/6] sched/dl: Improve capacity-aware wakeup Luca Abeni
2019-05-08 9:08 ` Juri Lelli
2019-05-08 9:24 ` luca abeni
2019-05-08 12:05 ` Juri Lelli
2019-05-08 12:47 ` luca abeni
2019-05-08 13:10 ` Juri Lelli
2019-05-08 14:12 ` luca abeni
2019-05-06 4:48 ` [RFC PATCH 5/6] sched/dl: If the task does not fit anywhere, select the fastest core Luca Abeni
2019-05-06 4:48 ` [RFC PATCH 6/6] sched/dl: Try not to select a too fast core Luca Abeni
2019-05-07 15:57 ` Quentin Perret
2019-05-08 6:26 ` luca abeni [this message]
2019-05-09 13:46 ` Quentin Perret
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190508082605.623ed4d5@nowhere \
--to=luca.abeni@santannapisa.it \
--cc=bristot@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=mingo@redhat.com \
--cc=morten.rasmussen@arm.com \
--cc=patrick.bellasi@arm.com \
--cc=paulmck@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=quentin.perret@arm.com \
--cc=rafael@kernel.org \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox