All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/7] feec() energy margin removal
@ 2022-04-29 14:11 Vincent Donnefort
  2022-04-29 14:11 ` [PATCH v8 1/7] sched/fair: Provide u64 read for 32-bits arch helper Vincent Donnefort
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Vincent Donnefort @ 2022-04-29 14:11 UTC (permalink / raw)
  To: peterz, mingo, vincent.guittot
  Cc: linux-kernel, dietmar.eggemann, morten.rasmussen, chris.redpath,
	qperret, tao.zhou, Vincent Donnefort

find_energy_efficient() (feec()) will migrate a task to save energy only
if it saves at least 6% of the total energy consumed by the system. This
conservative approach is a problem on a system where a lot of small tasks
create a huge load on the overall: very few of them will be allowed to migrate
to a smaller CPU, wasting a lot of energy. Instead of trying to determine yet
another margin, let's try to remove it.

The first elements of this patch-set are various fixes and improvement that
stabilizes task_util and ensures energy comparison fairness across all CPUs of
the topology. Only once those fixed, we can completely remove the margin and
let feec() aggressively place task and save energy.

This has been validated by two different ways:

First using LISA's eas_behaviour test suite. This is composed of a set of
scenario and verify if the task placement is optimum. No failure have been
observed and it also improved some tests such as Ramp-Down (as the placement
is now more energy oriented) and *ThreeSmall (as no bouncing between clusters
happen anymore).

  * Hikey960: 100% PASSED
  * DB-845C:  100% PASSED
  * RB5:      100% PASSED

Second, using an Android benchmark: PCMark2 on a Pixel4, with a lot of
backports to have a scheduler as close as we can from mainline. 

  +------------+-----------------+-----------------+
  |    Test    |      Perf       |    Energy [1]   |
  +------------+-----------------+-----------------+
  | Web2       | -0.3% pval 0.03 | -1.8% pval 0.00 |
  | Video2     | -0.3% pval 0.13 | -5.6% pval 0.00 |
  | Photo2 [2] | -3.8% pval 0.00 | -1%   pval 0.00 |
  | Writing2   |  0%   pval 0.13 | -1%   pval 0.00 |
  | Data2      |  0%   pval 0.8  | -0.43 pval 0.00 |
  +------------+-----------------+-----------------+ 

The margin removal let the kernel make the best use of the Energy Model,
tasks are more likely to be placed where they fit and this saves a 
substantial amount of energy, while having a limited impact on performances.

[1] This is an energy estimation based on the CPU activity and the Energy Model
for this device. "All models are wrong but some are useful"; yes, this is an
imperfect estimation that doesn't take into account some idle states and shared
power rails. Nonetheless this is based on the information the kernel has during
runtime and it proves the scheduler can take better decisions based solely on
those data.

[2] This is the only performance impact observed. The debugging of this test
showed no issue with task placement. The better score was solely due to some
critical threads held on better performing CPUs. If a thread needs a higher
capacity CPU, the placement must result from a user input (with e.g. uclamp
min) instead of being artificially held on less efficient CPUs by feec().
Notice also, the experiment didn't use the Android only latency_sensitive
feature which would hide this problem on a real-life device.

v7 -> v8:
  - PELT migration decay: Refine estimation computation. (vincent G.)
  - PELT migration decay: Do not apply estimation if load_avg is decayed (Tao)
  - PELT migration decay: throttled_pelt_idle update ordering for the
    update_blocked_load case. (vincent G.)

v6 -> v7:
  - PELT migration decay: Add missing clock_pelt_idle updates.
  - PELT migration decay: Fix PELT scaling delta for CONFIG_CFS_BANDWIDTH.

v5 -> v6:
  - Fix !CONFIG_SMP build.

v4 -> v5:
  - PELT migration decay: timestamp only at idle time (Vincent G.)
  - PELT migration decay: split timestamp values (enter_idle / clock_pelt_idle)
    (Vincent G.)

v3 -> v4:
  - Minor cosmetic changes (Dietmar)

v2 -> v3:
  - feec(): introduce energy_env struct (Dietmar)
  - PELT migration decay: Only apply when src CPU is idle (Vincent G.)
  - PELT migration decay: Do not apply when cfs_rq is throttled
  - PELT migration decay: Snapshot the lag at cfs_rq's level

v1 -> v2:
  - Fix PELT migration last_update_time (previously root cfs_rq's).
  - Add Dietmar's patches to refactor feec()'s CPU loop.
  - feec(): renaming busy time functions get_{pd,tsk}_busy_time()
  - feec(): pd_cap computation in the first for_each_cpu loop.
  - feec(): create get_pd_max_util() function (previously within compute_energy())
  - feec(): rename base_energy_pd to base_energy.

Dietmar Eggemann (3):
  sched, drivers: Remove max param from
    effective_cpu_util()/sched_cpu_util()
  sched/fair: Rename select_idle_mask to select_rq_mask
  sched/fair: Use the same cpumask per-PD throughout
    find_energy_efficient_cpu()

Vincent Donnefort (4):
  sched/fair: Provide u64 read for 32-bits arch helper
  sched/fair: Decay task PELT values during wakeup migration
  sched/fair: Remove task_util from effective utilization in feec()
  sched/fair: Remove the energy margin in feec()

 drivers/powercap/dtpm_cpu.c       |  33 +--
 drivers/thermal/cpufreq_cooling.c |   6 +-
 include/linux/sched.h             |   2 +-
 kernel/sched/core.c               |  15 +-
 kernel/sched/cpufreq_schedutil.c  |   5 +-
 kernel/sched/fair.c               | 379 ++++++++++++++++++------------
 kernel/sched/pelt.h               |  28 ++-
 kernel/sched/sched.h              |  53 ++++-
 8 files changed, 318 insertions(+), 203 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-05-06 13:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 14:11 [PATCH v8 0/7] feec() energy margin removal Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 1/7] sched/fair: Provide u64 read for 32-bits arch helper Vincent Donnefort
2022-05-05 18:25   ` Dietmar Eggemann
2022-05-05 18:44     ` Dietmar Eggemann
2022-04-29 14:11 ` [PATCH v8 2/7] sched/fair: Decay task PELT values during wakeup migration Vincent Donnefort
2022-04-29 17:09   ` Tao Zhou
2022-05-06 13:58     ` Vincent Guittot
2022-05-05 18:41   ` Dietmar Eggemann
2022-04-29 14:11 ` [PATCH v8 3/7] sched, drivers: Remove max param from effective_cpu_util()/sched_cpu_util() Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 4/7] sched/fair: Rename select_idle_mask to select_rq_mask Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 5/7] sched/fair: Use the same cpumask per-PD throughout find_energy_efficient_cpu() Vincent Donnefort
2022-04-29 14:11 ` [PATCH v8 6/7] sched/fair: Remove task_util from effective utilization in feec() Vincent Donnefort
2022-05-05 18:41   ` Dietmar Eggemann
2022-04-29 14:11 ` [PATCH v8 7/7] sched/fair: Remove the energy margin " Vincent Donnefort
2022-05-05 18:42   ` Dietmar Eggemann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.