[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67218e25-a472-baa0-19bf-71af26f5e767@arm.com>
Date: Fri, 29 Oct 2021 12:01:21 +0200
From: Dietmar Eggemann <dietmar.eggemann@....com>
To: Vincent Guittot <vincent.guittot@...aro.org>, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com, rostedt@...dmis.org,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
linux-kernel@...r.kernel.org, tim.c.chen@...ux.intel.com
Subject: Re: [PATCH 3/5] sched/fair: Wait before decaying max_newidle_lb_cost
On 19/10/2021 14:35, Vincent Guittot wrote:
> Decay max_newidle_lb_cost only when it has not been updated for a while
> and ensure to not decay a recently changed value.
>
> Signed-off-by: Vincent Guittot <vincent.guittot@...aro.org>
> ---
> include/linux/sched/topology.h | 2 +-
> kernel/sched/fair.c | 36 +++++++++++++++++++++++++---------
> kernel/sched/topology.c | 2 +-
> 3 files changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index 2f9166f6dec8..c07bfa2d80f2 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -105,7 +105,7 @@ struct sched_domain {
>
> /* idle_balance() stats */
> u64 max_newidle_lb_cost;
> - unsigned long next_decay_max_lb_cost;
> + unsigned long last_decay_max_lb_cost;
>
> u64 avg_scan_cost; /* select_idle_sibling */
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c4c36865321b..e50fd751e1df 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10239,6 +10239,30 @@ void update_max_interval(void)
> max_load_balance_interval = HZ*num_online_cpus()/10;
> }
>
> +static inline bool update_newidle_cost(struct sched_domain *sd, u64 cost)
> +{
> + if (cost > sd->max_newidle_lb_cost) {
> + /*
> + * Track max cost of a domain to make sure to not delay the
> + * next wakeup on the CPU.
> + */
> + sd->max_newidle_lb_cost = cost;
> + sd->last_decay_max_lb_cost = jiffies;
That's the actual change of the patch: sd->last_decay_max_lb_cost being
moved forward also when newidle cost is updated from newidle_balance() ?
> + } else if (time_after(jiffies, sd->last_decay_max_lb_cost + HZ)) {
> + /*
> + * Decay the newidle max times by ~1% per second to ensure that
> + * it is not outdated and the current max cost is actually
> + * shorter.
I assume that `max cost` refers here to a local variable of the only
caller of update_newidle_cost(..., 0) - rebalance_domains()?
"the current max cost" has to be shorter so that
rq->max_idle_balance_cost also decays in this case. Is this what this
comment tries to say here?
[...]
Powered by blists - more mailing lists