sched: reduce sched slice for SCHED_IDLE entities
authorJosh Don <joshdon@google.com>
Fri, 20 Aug 2021 01:04:02 +0000 (18:04 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Oct 2021 13:51:37 +0000 (15:51 +0200)
commit51ce83ed523b00d58f2937ec014b12daaad55185
treea1c3c6f96f30870a81917a4c85e4d53da60d3d2a
parenta480addecc0d89c200ec0b41da62ae8ceddca8d7
sched: reduce sched slice for SCHED_IDLE entities

Use a small, non-scaled min granularity for SCHED_IDLE entities, when
competing with normal entities. This reduces the latency of getting
a normal entity back on cpu, at the expense of increased context
switch frequency of SCHED_IDLE entities.

The benefit of this change is to reduce the round-robin latency for
normal entities when competing with a SCHED_IDLE entity.

Example: on a machine with HZ=1000, spawned two threads, one of which is
SCHED_IDLE, and affined to one cpu. Without this patch, the SCHED_IDLE
thread runs for 4ms then waits for 1.4s. With this patch, it runs for
1ms and waits 340ms (as it round-robins with the other thread).

Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20210820010403.946838-4-joshdon@google.com
kernel/sched/debug.c
kernel/sched/fair.c
kernel/sched/sched.h