[PATCH] sched/fair: Fix se_is_idle() for !FAIR_GROUP_SCHED

From: Daniel Jordan
Date: Wed Sep 08 2021 - 16:40:39 EST


se_is_idle() unconditionally returns 0 for !FAIR_GROUP_SCHED.

Check whether the task is SCHED_IDLE instead so buddies aren't set for
such tasks, as was the behavior before 304000390f88.

Fixes: 304000390f88 ("sched: Cgroup SCHED_IDLE support")
Signed-off-by: Daniel Jordan <daniel.m.jordan@xxxxxxxxxx>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ff69f245b939..8b22665bc18e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -497,7 +497,7 @@ static int cfs_rq_is_idle(struct cfs_rq *cfs_rq)

static int se_is_idle(struct sched_entity *se)
{
- return 0;
+ return task_has_idle_policy(task_of(se));
}

#endif /* CONFIG_FAIR_GROUP_SCHED */

base-commit: ac08b1c68d1b1ed3cebb218fc3ea2c07484eb07d
--
2.32.0