]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sched/fair: Make SCHED_IDLE entity be preempted in strict hierarchy
authorTianchen Ding <dtcccc@linux.alibaba.com>
Wed, 26 Jun 2024 02:35:05 +0000 (10:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:14 +0000 (16:29 +0200)
commit5a4f8de92dd7ddaa7ce33aa804cbad254b844b8f
treef719483b1a9c1226e760acadcdcee6f052a729ee
parent82478cb8a23bd4f97935bbe60d64528c6d9918b4
sched/fair: Make SCHED_IDLE entity be preempted in strict hierarchy

[ Upstream commit faa42d29419def58d3c3e5b14ad4037f0af3b496 ]

Consider the following cgroup:

                       root
                        |
             ------------------------
             |                      |
       normal_cgroup            idle_cgroup
             |                      |
   SCHED_IDLE task_A           SCHED_NORMAL task_B

According to the cgroup hierarchy, A should preempt B. But current
check_preempt_wakeup_fair() treats cgroup se and task separately, so B
will preempt A unexpectedly.
Unify the wakeup logic by {c,p}se_is_idle only. This makes SCHED_IDLE of
a task a relative policy that is effective only within its own cgroup,
similar to the behavior of NICE.

Also fix se_is_idle() definition when !CONFIG_FAIR_GROUP_SCHED.

Fixes: 304000390f88 ("sched: Cgroup SCHED_IDLE support")
Signed-off-by: Tianchen Ding <dtcccc@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Don <joshdon@google.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20240626023505.1332596-1-dtcccc@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/fair.c