linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: brookxu <brookxu.cn@gmail.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Xuewen Yan <xuewen.yan94@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Benjamin Segall <bsegall@google.com>,
	Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] sched/fair: use max_spare_cap_cpu if it is more energy efficient
Date: Thu, 28 Oct 2021 10:08:02 +0800	[thread overview]
Message-ID: <165924b0-e000-cc86-dff9-8bd250827e0f@gmail.com> (raw)
In-Reply-To: <d51b64b2-8efc-898b-d836-2917b5cf2d85@arm.com>



Dietmar Eggemann wrote on 2021/10/25 9:04 下午:
> On 22/10/2021 06:05, Xuewen Yan wrote:
>> Hi Chunguang
>>
>> brookxu <brookxu.cn@gmail.com> 于2021年10月21日周四 下午4:24写道:
>>>
>>> From: Chunguang Xu <brookxu@tencent.com>
>>>
>>> When debugging EAS, I found that if the task is migrated to
>>> max_spare_cap_cpu, even if the power consumption of pd is lower,
> 
> The task p hasn't been migrated yet. `max_spare_cap_cpu` here is only a
> potential candidate CPU to be selected for p.
> 
>>> we still put the task on prev_cpu. Maybe we should fix it.
>>>
>>> Signed-off-by: Chunguang Xu <brookxu@tencent.com>
>>> ---
>>>  kernel/sched/fair.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>>> index ff69f245b939..2ae7e03de6d2 100644
>>> --- a/kernel/sched/fair.c
>>> +++ b/kernel/sched/fair.c
>>> @@ -6867,8 +6867,10 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
>>>                 /* Evaluate the energy impact of using max_spare_cap_cpu. */
>>>                 if (max_spare_cap_cpu >= 0) {
>>>                         cur_delta = compute_energy(p, max_spare_cap_cpu, pd);
>>> -                       if (cur_delta < base_energy_pd)
>>
>> this is aimed to prevent the cur_delta < 0, and usuallly, when the
>> task was put on the max_spare_cpu, the cur_power should be bigger than
>> base_pd_power,
>> if the cur_power < base_pd_power, the cpu util may have changed, at
>> this time, we should keep prev_cpu.
>>
>> You can look at below discuss and patch:
>> https://lore.kernel.org/all/20210429101948.31224-3-Pierre.Gondois@arm.com/
>> https://lore.kernel.org/all/CAB8ipk_vgtg5d1obH36BYfNLZosbwr2k_U3xnAD4=H5uZt_M_g@mail.gmail.com/
> 
> That's correct. `prev_delta < base_energy_pd` or `cur_delta <
> base_energy_pd` indicate the rare case that `compute_energy() { ->
> cpu_util_next() -> cpu util }` returns a higher energy value for the
> perf domain w/o the task p than w/ it.
> 
> `base_energy_pd` stands for the energy spend on the CPUs of the Perf
> Domain (PD) w/o considering the task p (compute_energy(p, *-1*, pd)),
> `dst_cpu == -1`.
> 
> If this happens to a candidate CPU (prev_cpu or a per-PD
> max_spare_cap_cpu) we bail out and return target (i.e. prev_cpu) because
> we can't compare the energy values (prev_delta and best_delta) later on
> in this case.

Right, thanks all :)

> [...]
> 

      reply	other threads:[~2021-10-28  2:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  8:23 [RFC PATCH] sched/fair: use max_spare_cap_cpu if it is more energy efficient brookxu
2021-10-22  4:05 ` Xuewen Yan
2021-10-25 13:04   ` Dietmar Eggemann
2021-10-28  2:08     ` brookxu [this message]

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=165924b0-e000-cc86-dff9-8bd250827e0f@gmail.com \
    --to=brookxu.cn@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=xuewen.yan94@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).