mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sched/fair: Avoid calling sync_entity_load_avg() unnecessarily
Date: Fri, 27 Apr 2018 10:30:39 +0200	[thread overview]
Message-ID: <c1dba90d-d464-9286-94e3-e399f0b71281@arm.com> (raw)
In-Reply-To: <cd019d1753824c81130eae7b43e2bbcec47cc1ad.1524738578.git.viresh.kumar@linaro.org>

Hi Viresh,

On 04/26/2018 12:30 PM, Viresh Kumar wrote:
> Call sync_entity_load_avg() directly from find_idlest_cpu() instead of
> select_task_rq_fair(), as that's where we need to use task's utilization
> value. And call sync_entity_load_avg() only after making sure sched
> domain spans over one of the allowed CPUs for the task.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

The patch looks correct to me but we want to have the waking task synced 
against its previous rq also for EAS, i.e. for 
find_energy_efficient_cpu() which will sit next to find_idlest_cpu().

https://marc.info/?l=linux-kernel&m=152302907327168&w=2

The comment on top of the if condition would have to be changed though.

I would suggest we leave the call to sync_entity_load_avg() in the slow 
path of strf() so that we're not forced to call it in 
find_energy_efficient_cpu().

> ---
>   kernel/sched/fair.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 84fc74ddbd4b..5b1b4f91f132 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6199,6 +6199,13 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p
>   	if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed))
>   		return prev_cpu;
>   
> +	/*
> +	 * We need task's util for capacity_spare_wake, sync it up to prev_cpu's
> +	 * last_update_time.
> +	 */
> +	if (!(sd_flag & SD_BALANCE_FORK))
> +		sync_entity_load_avg(&p->se);
> +
>   	while (sd) {
>   		struct sched_group *group;
>   		struct sched_domain *tmp;
> @@ -6651,15 +6658,6 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
>   
>   	if (unlikely(sd)) {
>   		/* Slow path */
> -
> -		/*
> -		 * We're going to need the task's util for capacity_spare_wake
> -		 * in find_idlest_group. Sync it up to prev_cpu's
> -		 * last_update_time.
> -		 */
> -		if (!(sd_flag & SD_BALANCE_FORK))
> -			sync_entity_load_avg(&p->se);
> -
>   		new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag);
>   	} else if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */
>   		/* Fast path */
> 

  reply	other threads:[~2018-04-27  8:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 10:30 [PATCH V2 1/2] sched/fair: Rearrange select_task_rq_fair() to optimize it Viresh Kumar
2018-04-26 10:30 ` [PATCH 2/2] sched/fair: Avoid calling sync_entity_load_avg() unnecessarily Viresh Kumar
2018-04-27  8:30   ` Dietmar Eggemann [this message]
2018-04-27  9:30     ` Viresh Kumar
2018-04-27 11:25     ` Quentin Perret
2018-05-04  9:37   ` [tip:sched/core] " tip-bot for Viresh Kumar
2018-04-26 14:35 ` [PATCH V2 1/2] sched/fair: Rearrange select_task_rq_fair() to optimize it Valentin Schneider
2018-05-04  9:36 ` [tip:sched/core] " tip-bot for Viresh Kumar

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=c1dba90d-d464-9286-94e3-e399f0b71281@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@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

all inboxes | Powered by JetHome®