From: Pavan Kondeti <pkondeti@codeaurora.org>
To: Valentin Schneider <valentin.schneider@arm.com>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com,
peterz@infradead.org, vincent.guittot@linaro.org,
dietmar.eggemann@arm.com, morten.rasmussen@arm.com,
qperret@google.com, adharmap@codeaurora.org
Subject: Re: [PATCH v3 1/3] sched/fair: Add asymmetric CPU capacity wakeup scan
Date: Tue, 28 Jan 2020 11:52:45 +0530 [thread overview]
Message-ID: <20200128062245.GA27398@codeaurora.org> (raw)
In-Reply-To: <20200126200934.18712-2-valentin.schneider@arm.com>
Hi Valentin,
On Sun, Jan 26, 2020 at 08:09:32PM +0000, Valentin Schneider wrote:
>
> +static inline int check_cpu_capacity(struct rq *rq, struct sched_domain *sd);
> +
> +/*
> + * Scan the asym_capacity domain for idle CPUs; pick the first idle one on which
> + * the task fits. If no CPU is big enough, but there are idle ones, try to
> + * maximize capacity.
> + */
> +static int select_idle_capacity(struct task_struct *p, int target)
> +{
> + unsigned long best_cap = 0;
> + struct sched_domain *sd;
> + struct cpumask *cpus;
> + int best_cpu = -1;
> + struct rq *rq;
> + int cpu;
> +
> + if (!static_branch_unlikely(&sched_asym_cpucapacity))
> + return -1;
> +
> + sd = rcu_dereference(per_cpu(sd_asym_cpucapacity, target));
> + if (!sd)
> + return -1;
> +
> + sync_entity_load_avg(&p->se);
> +
> + cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
> + cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
> +
> + for_each_cpu_wrap(cpu, cpus, target) {
> + rq = cpu_rq(cpu);
> +
> + if (!available_idle_cpu(cpu))
> + continue;
> + if (task_fits_capacity(p, rq->cpu_capacity))
> + return cpu;
I have couple of questions.
(1) Any particular reason for not checking sched_idle_cpu() as a backup
for the case where all eligible CPUs are busy? select_idle_cpu() does
that.
(2) Assuming all CPUs are busy, we return -1 from here and end up
calling select_idle_cpu(). The traversal in select_idle_cpu() may be
waste in cases where sd_llc == sd_asym_cpucapacity . For example SDM845.
Should we worry about this?
> +
> + /*
> + * It would be silly to keep looping when we've found a CPU
> + * of highest available capacity. Just check that it's not been
> + * too pressured lately.
> + */
> + if (rq->cpu_capacity_orig == READ_ONCE(rq->rd->max_cpu_capacity) &&
> + !check_cpu_capacity(rq, sd))
> + return cpu;
> +
> + if (rq->cpu_capacity > best_cap) {
> + best_cap = rq->cpu_capacity;
> + best_cpu = cpu;
> + }
> + }
> +
> + return best_cpu;
> +}
> +
> /*
> * Try and locate an idle core/thread in the LLC cache domain.
> */
> @@ -5902,6 +5956,11 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
> struct sched_domain *sd;
> int i, recent_used_cpu;
>
> + /* For asymmetric capacities, try to be smart about the placement */
> + i = select_idle_capacity(p, target);
> + if ((unsigned)i < nr_cpumask_bits)
> + return i;
> +
> if (available_idle_cpu(target) || sched_idle_cpu(target))
> return target;
>
> --
> 2.24.0
>
Thanks,
Pavan
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2020-01-28 6:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-26 20:09 [PATCH v3 0/3] sched/fair: Capacity aware wakeup rework Valentin Schneider
2020-01-26 20:09 ` [PATCH v3 1/3] sched/fair: Add asymmetric CPU capacity wakeup scan Valentin Schneider
2020-01-28 6:22 ` Pavan Kondeti [this message]
2020-01-28 11:30 ` Valentin Schneider
2020-01-29 3:52 ` Pavan Kondeti
2020-01-29 8:16 ` Qais Yousef
2020-01-29 9:25 ` Valentin Schneider
2020-01-29 10:38 ` Dietmar Eggemann
2020-01-29 12:10 ` Valentin Schneider
2020-01-29 11:04 ` Dietmar Eggemann
2020-01-29 12:10 ` Valentin Schneider
2020-01-26 20:09 ` [PATCH v3 2/3] sched/topology: Remove SD_BALANCE_WAKE on asymmetric capacity systems Valentin Schneider
2020-01-29 16:27 ` Dietmar Eggemann
2020-01-30 11:06 ` Valentin Schneider
2020-01-26 20:09 ` [PATCH v3 3/3] sched/fair: Kill wake_cap() Valentin Schneider
2020-01-28 9:24 ` [PATCH v3 0/3] sched/fair: Capacity aware wakeup rework Dietmar Eggemann
2020-01-28 11:34 ` Valentin Schneider
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=20200128062245.GA27398@codeaurora.org \
--to=pkondeti@codeaurora.org \
--cc=adharmap@codeaurora.org \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=morten.rasmussen@arm.com \
--cc=peterz@infradead.org \
--cc=qperret@google.com \
--cc=valentin.schneider@arm.com \
--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
Powered by JetHome