public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/10 v2] sched/fair: Fix statistics with delayed dequeue
@ 2024-11-29 16:17 Vincent Guittot
  2024-11-29 16:17 ` [PATCH 01/10 v2] sched/eevdf: More PELT vs DELAYED_DEQUEUE Vincent Guittot
                   ` (10 more replies)
  0 siblings, 11 replies; 26+ messages in thread
From: Vincent Guittot @ 2024-11-29 16:17 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, dietmar.eggemann, rostedt, bsegall,
	mgorman, vschneid, linux-kernel
  Cc: kprateek.nayak, pauld, efault, luis.machado, Vincent Guittot

Delayed dequeued feature keeps a sleeping sched_entitiy enqueued until its
lag has elapsed. As a result, it stays also visible in the statistics that
are used to balance the system and in particular the field h_nr_running.

This serie fixes those metrics by creating a new h_nr_queued that tracks
all queued tasks. It renames h_nr_running into h_nr_runnable and restores
the behavior of h_nr_running i.e. tracking the number of fair tasks that
 want to run.

h_nr_runnable is used in several places to make decision on load balance:
  - PELT runnable_avg
  - deciding if a group is overloaded or has spare capacity
  - numa stats
  - reduced capacity management
  - load balance between groups

While fixing h_nr_running, some fields have been renamed to follow the
same pattern. We now have:
  - cfs.h_nr_runnable : running tasks in the hierarchy
  - cfs.h_nr_queued : enqueued tasks in the hierarchy either running or
      delayed dequeue
  - cfs.h_nr_idle : enqueued sched idle tasks in the hierarchy

cfs.nr_running has been rename cfs.nr_queued because it includes the
delayed dequeued entities

The unused cfs.idle_nr_running has been removed

Load balance compares the number of running tasks when selecting the
busiest group or runqueue and tries to migrate a runnable task and not a
sleeping delayed dequeue one.

It should be noticed that this serie doesn't fix the problem of delayed
dequeued tasks that can't migrate at wakeup.

Some additional cleanups have been added:
  - move variable declaration at the beginning of pick_next_entity() 
  - sched_can_stop_tick() should use cfs.h_nr_enqueued instead of
    cfs.nr_enqueued (previously cfs.nr_running) to know how many tasks
    are running in the whole hierarchy instead of how many entities at
    root level

Changes since v1:
- reorder the patches
- rename fields into:
  - h_nr_queued for all tasks queued both runnable and delayed dequeue
  - h_nr_runnable for all runnable tasks
  - h_nr_idle for all tasks with sched_idle policy
- Cleanup how h_nr_runnable is updated in enqueue_task_fair() and
  dequeue_entities

Peter Zijlstra (1):
  sched/eevdf: More PELT vs DELAYED_DEQUEUE

Vincent Guittot (9):
  sched/fair: Rename h_nr_running into h_nr_queued
  sched/fair: Add new cfs_rq.h_nr_runnable
  sched/fair: Removed unsued cfs_rq.h_nr_delayed
  sched/fair: Rename cfs_rq.idle_h_nr_running into h_nr_idle
  sched/fair: Remove unused cfs_rq.idle_nr_running
  sched/fair: Rename cfs_rq.nr_running into nr_queued
  sched/fair: Do not try to migrate delayed dequeue task
  sched/fair: Fix sched_can_stop_tick() for fair tasks
  sched/fair: Fix variable declaration position

 kernel/sched/core.c  |   4 +-
 kernel/sched/debug.c |  15 ++-
 kernel/sched/fair.c  | 236 +++++++++++++++++++++++++------------------
 kernel/sched/pelt.c  |   4 +-
 kernel/sched/sched.h |  12 +--
 5 files changed, 152 insertions(+), 119 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2024-12-02 18:35 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 16:17 [PATCH 0/10 v2] sched/fair: Fix statistics with delayed dequeue Vincent Guittot
2024-11-29 16:17 ` [PATCH 01/10 v2] sched/eevdf: More PELT vs DELAYED_DEQUEUE Vincent Guittot
2024-11-29 16:17 ` [PATCH 02/10 v2] sched/fair: Rename h_nr_running into h_nr_queued Vincent Guittot
2024-11-29 16:17 ` [PATCH 03/10 v2] sched/fair: Add new cfs_rq.h_nr_runnable Vincent Guittot
2024-12-02  9:54   ` Peter Zijlstra
2024-12-02  9:57     ` Vincent Guittot
2024-11-29 16:17 ` [PATCH 04/10 v2] sched/fair: Removed unsued cfs_rq.h_nr_delayed Vincent Guittot
2024-11-29 16:17 ` [PATCH 05/10 v2] sched/fair: Rename cfs_rq.idle_h_nr_running into h_nr_idle Vincent Guittot
2024-11-29 16:17 ` [PATCH 06/10 v2] sched/fair: Remove unused cfs_rq.idle_nr_running Vincent Guittot
2024-11-29 16:17 ` [PATCH 07/10 v2] sched/fair: Rename cfs_rq.nr_running into nr_queued Vincent Guittot
2024-11-29 16:17 ` [PATCH 08/10 v2] sched/fair: Do not try to migrate delayed dequeue task Vincent Guittot
2024-11-29 16:17 ` [PATCH 09/10 v2] sched/fair: Fix sched_can_stop_tick() for fair tasks Vincent Guittot
2024-11-29 18:26   ` K Prateek Nayak
2024-12-02  9:18     ` Vincent Guittot
2024-11-29 16:17 ` [PATCH 10/10 v2] sched/fair: Fix variable declaration position Vincent Guittot
2024-11-29 18:30   ` K Prateek Nayak
2024-12-02  9:19     ` Vincent Guittot
2024-12-01 13:30 ` [PATCH 0/10 v2] sched/fair: Fix statistics with delayed dequeue Mike Galbraith
2024-12-02  9:17   ` Vincent Guittot
2024-12-02  9:23     ` Luis Machado
2024-12-02  9:59       ` Vincent Guittot
2024-12-02 13:52         ` Dietmar Eggemann
2024-12-02  9:58     ` K Prateek Nayak
2024-12-02 11:42       ` Vincent Guittot
2024-12-02 14:24         ` Vincent Guittot
2024-12-02 18:34     ` Mike Galbraith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox