Skip to contentSkip to conversation

sched/core: Fix prio for fair in __task_prio

PATCH New Wang Jinchao 1 participant 1 message Jan 29, 2024 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/core: Fix prio for fair in __task_prio

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.

---
 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/core.c +2 -2
index 9116bcc90346..13484ee71e5b 100644
@@ -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;
Signature · 1 line
2.40.0