[PATCH] sched/core: Fix prio for fair in __task_prio
From: Wang Jinchao
Date: Mon Jan 29 2024 - 05:27:10 EST
It is said "120" in the comment, but MAX_RT_PRIO + MAX_NICE equals 119.
DEFAULT_PRIO should be the right prio.
Fix it and imodify the corresponding prio in prio_less.
Signed-off-by: Wang Jinchao <wangjinchao@xxxxxxxxxxx>
---
kernel/sched/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9116bcc90346..13484ee71e5b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -168,7 +168,7 @@ static inline int __task_prio(const struct task_struct *p)
if (p->sched_class == &idle_sched_class)
return MAX_RT_PRIO + NICE_WIDTH; /* 140 */
- return MAX_RT_PRIO + MAX_NICE; /* 120, squash fair */
+ return DEFAULT_PRIO; /* 120, squash fair */
}
/*
@@ -194,7 +194,7 @@ static inline bool prio_less(const struct task_struct *a,
if (pa == -1) /* dl_prio() doesn't work because of stop_class above */
return !dl_time_before(a->dl.deadline, b->dl.deadline);
- if (pa == MAX_RT_PRIO + MAX_NICE) /* fair */
+ if (pa == DEFAULT_PRIO) /* fair */
return cfs_prio_less(a, b, in_fi);
return false;
--
2.40.0