]> git.baikalelectronics.ru Git - kernel.git/commit
sched: adjust sleeper credit for SCHED_IDLE entities
authorJosh Don <joshdon@google.com>
Fri, 20 Aug 2021 01:04:03 +0000 (18:04 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Oct 2021 13:51:39 +0000 (15:51 +0200)
commit5f4c99fccf9605a0363e1bc6e436b2a3afea735c
tree1eec087e76212e1c7a3d4aaf20ae8eb0f0d8e139
parent8d58ceef0c6ac8c84716e9c8b5c91d6d7e3bd8c5
sched: adjust sleeper credit for SCHED_IDLE entities

Give reduced sleeper credit to SCHED_IDLE entities. As a result, woken
SCHED_IDLE entities will take longer to preempt normal entities.

The benefit of this change is to make it less likely that a newly woken
SCHED_IDLE entity will preempt a short-running normal entity before it
blocks.

We still give a small sleeper credit to SCHED_IDLE entities, so that
idle<->idle competition retains some fairness.

Example: With HZ=1000, spawned four threads affined to one cpu, one of
which was set to SCHED_IDLE. Without this patch, wakeup latency for the
SCHED_IDLE thread was ~1-2ms, with the patch the wakeup latency was
~5ms.

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>
Reviewed-by: Jiang Biao <benbjiang@tencent.com>
Link: https://lore.kernel.org/r/20210820010403.946838-5-joshdon@google.com
kernel/sched/fair.c