mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Hongyan Xia <hongyan.xia2@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>
Cc: Qais Yousef <qyousef@layalina.io>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Christian Loehle <christian.loehle@arm.com>,
	linux-kernel@vger.kernel.org, David Dai <davidai@google.com>,
	Saravana Kannan <saravanak@google.com>
Subject: Re: [RFC PATCH v2 1/7] Revert "sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0"
Date: Tue, 19 Mar 2024 16:34:16 +0100	[thread overview]
Message-ID: <37be0494-7e38-4275-b6eb-62a2eb2f6d46@arm.com> (raw)
In-Reply-To: <b29e7df921ce07c2c2dbbde390e234d162756c42.1706792708.git.hongyan.xia2@arm.com>

On 01/02/2024 14:11, Hongyan Xia wrote:
> From: Hongyan Xia <Hongyan.Xia2@arm.com>
> 
> That commit creates further problems because 0 spare capacity can be
> either a real indication that the CPU is maxed out, or the CPU is
> UCLAMP_MAX throttled, but we end up giving all of them a chance which
> can results in bogus energy calculations. It also tends to schedule
> tasks on the same CPU and requires load balancing patches. Sum
> aggregation solves these problems and this patch is not needed.
> 
> This reverts commit 6b00a40147653c8ea748e8f4396510f252763364.

I assume you did this revert especially for the 'Scenario 5: 8 tasks
with UCLAMP_MAX of 120' testcase?

IMHO, the issue is especially visible in compute_energy()'s busy_time
computation with a valid destination CPU (dst_cpu >= 0). I.e. when we
have to add performance domain (pd) and task busy time.

find_energy_efficient_cpu() (feec())

 for each pd
  for each cpu in pd

   set {prev_,max}_spare_cap

 bail if prev_ and max_spare_cap < 0 (was == 0 before )

 {base_,prev_,cur_}energy = compute_energy

So with the patch we potentially compute energy for a saturated PD
according:

 compute_energy()

  if (dst_cpu >= 0)
   busy_time = min(eenv->pd_cap, eenv->busy_time + eenv->task_busy_time)
                   <----(a)--->  <--------------(b)------------------->

  energy = em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap)

If (b) > (a) then we're saturated and 'energy' is bogus.

The way to fix this is up for discussion:

(1) feec() returning prev_cpu
(2) feec() returning -1 (forcing wakeup into sis() -> sic())
(3) using uclamped values for task and rq utilization

None of those have immediately given the desired task placement on
mainline (2 tasks on each of the 4 little CPUs and no task on the 2 big
CPUs on my [l B B l l l] w/ CPU capacities = [446 1024 1024 446 446 446]
machine) you can achieve with uclamp sum aggregation.

[...]

  reply	other threads:[~2024-03-19 15:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 13:11 [RFC PATCH v2 0/7] uclamp sum aggregation Hongyan Xia
2024-02-01 13:11 ` [RFC PATCH v2 1/7] Revert "sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0" Hongyan Xia
2024-03-19 15:34   ` Dietmar Eggemann [this message]
2024-03-19 17:05     ` Hongyan Xia
2024-02-01 13:11 ` [RFC PATCH v2 2/7] sched/uclamp: Track uclamped util_avg in sched_avg Hongyan Xia
2024-02-01 13:11 ` [RFC PATCH v2 3/7] sched/uclamp: Introduce root_cfs_util_uclamp for rq Hongyan Xia
2024-03-18 18:21   ` Dietmar Eggemann
2024-03-19 11:50     ` Hongyan Xia
2024-03-20 15:27       ` Dietmar Eggemann
2024-03-20 17:22         ` Hongyan Xia
2024-02-01 13:12 ` [RFC PATCH v2 4/7] sched/fair: Use CFS util_avg_uclamp for utilization and frequency Hongyan Xia
2024-03-15 12:31   ` Dietmar Eggemann
2024-03-15 19:47     ` Hongyan Xia
2024-02-01 13:12 ` [RFC PATCH v2 5/7] sched/fair: Massively simplify util_fits_cpu() Hongyan Xia
2024-02-01 13:12 ` [RFC PATCH v2 6/7] sched/uclamp: Remove all uclamp bucket logic Hongyan Xia
2024-02-01 13:12 ` [RFC PATCH v2 7/7] sched/uclamp: Simplify uclamp_eff_value() Hongyan Xia
2024-02-06 15:20 ` [RFC PATCH v2 0/7] uclamp sum aggregation Qais Yousef
2024-02-06 17:32   ` Hongyan Xia
2024-02-20 15:47     ` Qais Yousef
2024-02-20 22:42       ` Hongyan Xia
2024-02-12  9:16 ` Vincent Guittot
2024-02-12 13:56   ` Hongyan Xia

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=37be0494-7e38-4275-b6eb-62a2eb2f6d46@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=christian.loehle@arm.com \
    --cc=davidai@google.com \
    --cc=hongyan.xia2@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=saravanak@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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

all inboxes | Powered by JetHome®