Skip to content

Utilization estimation (util_est) for FAIR tasks

Patrick Bellasi linux-pm lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 1 replyIn review
  2. v54 patches 21 repliesSuperseded
  3. v43 patches 7 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches12 repliesSuperseded
v24 patches24 repliesSuperseded
v14 patches1 replySuperseded

Changes in v6 from the cover letter

- remove READ_ONCE from rq-lock protected code paths
- folds cpu_util_est code into cpu_util and update its documentation
- change util_est's update flag name to better match its usage
- slightly clean up cpu_util_wake code
- add other small code cleanups as suggested by Peter
- fix compilation for !CONFIG_SMP systems
- fix documentation to match sphinx syntax
- update changelogs to better match code concepts

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4sched/fair: add util_est on top of PELTinclude/linux/sched.h kernel/sched/debug.c kernel/sched/fair.c +1 more+153 -60 replies
2/4sched/fair: use util_est in LB and WU pathskernel/sched/fair.c+70 -140 replies
3/4sched/cpufreq_schedutil: use util_est for OPP selectionkernel/sched/sched.h+8 -10 replies
4/4sched/fair: update util_est only on util_avg updateskernel/sched/fair.c kernel/sched/features.h+39 -50 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchDietmar EggemannRafael J. WysockiViresh Kumar
1/4R-b
2/4R-b
3/4R-b A-b A-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH v6 0/4] Utilization estimation (util_est) for FAIR tasks

Hi, here is an update of [1], based on today's tip/sched/core [2], which mainly adds some code cleanups suggested by Peter as well as fixes compilation for !CONFIG_SMP systems.

Most notably:
a) The util_est's update flag has been renamed into UTIL_AVG_UNCHANGED, which seems to better match its usages.
b) The cpu_util_est() function has been removed to reduce cluttering by folding its code directly into cpu_util(). This last function is thus now always returning the estimated utilization of a CPU, unless this sched feature is disabled.
c) Not necessary READ_ONCE() have been removed from rq-lock protected code paths. For util_est variable, that we read/modify/write only from rq-lock protected, code we keep just the WRITE_ONCE() barriers, which are still required for synchronization with lockless readers.
The READ_ONCE() have been instead maintained in all the getter functions, like for example task_util() and cpu_util(), which can potentially be used by lockless code. e.g. schedutil or load-balancer.

Results on both x86_64 and ARM (Android) targets, which have been collected and reported in previous postings [1,3], show negligible overheads, especially compared to the corresponding power/performance benefits on mobile platforms, where this feature helps to reduce the performance gap between PELT and another other out-of-tree load tracking solution.

Best,
Patrick

.:: Changelog
=============

Changes in v6:
- remove READ_ONCE from rq-lock protected code paths
- folds cpu_util_est code into cpu_util and update its documentation
- change util_est's update flag name to better match its usage
- slightly clean up cpu_util_wake code
- add other small code cleanups as suggested by Peter
- fix compilation for !CONFIG_SMP systems
- fix documentation to match sphinx syntax
- update changelogs to better match code concepts

Changes in v5:
- rebased on today's tip/sched/core (commit 083c6eeab2cc, based on v4.16-rc2)
- update util_est only on util_avg updates
- add documentation for "struct util_est"
- always use int instead of long whenever possible (Peter)
- pass cfs_rq to util_est_{en,de}queue (Peter)
- pass task_sleep to util_est_dequeue
- use singe WRITE_ONCE at dequeue time
- add some missing {READ,WRITE}_ONCE
- add task_util_est() for code consistency

Changes in v4:
- rebased on today's tip/sched/core (commit 460e8c3340a2)
- renamed util_est's "last" into "enqueued"
- using util_est's "enqueued" for both se and cfs_rqs (Joel)
- update margin check to use more ASM friendly code (Peter)
- optimize EWMA updates (Peter)
- ensure cpu_util_wake() is cpu_capacity_orig()'s clamped (Pavan)
- simplify cpu_util_cfs() integration (Dietmar)

Changes in v3:
- rebased on today's tip/sched/core (commit 07881166a892)
- moved util_est into sched_avg (Peter)
- use {READ,WRITE}_ONCE() for EWMA updates (Peter)
- using unsigned int to fit all sched_avg into a single 64B cache line
- schedutil integration using Juri's cpu_util_cfs()
- first patch dropped since it's already queued in tip/sched/core

Changes in v2:
- rebased on top of v4.15-rc2
- tested that overhauled PELT code does not affect the util_est

.:: References
==============
[1] https://lkml.org/lkml/2018/2/22/639

    [email protected]
[2] git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
    sched/core (commit 083c6eeab2cc)
[3] https://lkml.org/lkml/2018/1/23/645
    [email protected]

Patrick Bellasi (4):
sched/fair: add util_est on top of PELT sched/fair: use util_est in LB and WU paths sched/cpufreq_schedutil: use util_est for OPP selection sched/fair: update util_est only on util_avg updates

 include/linux/sched.h   |  29 ++++++
 kernel/sched/debug.c    |   4 +
 kernel/sched/fair.c     | 237 ++++++++++++++++++++++++++++++++++++++++++++----
 kernel/sched/features.h |   5 +
 kernel/sched/sched.h    |   9 +-
 5 files changed, 264 insertions(+), 20 deletions(-)
Signature · 1 line
2.15.1