Skip to contentSkip to conversation

sched/deadline: fix BUG_ON() ENQUEUE_REPLENISH check

PATCH In review [email protected] 2 participants 2 messages Feb 6, 2021 – Feb 8, 2021 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/deadline: fix BUG_ON() ENQUEUE_REPLENISH check

From: Tom Rix <[email protected]>

When the BUG_ON check for (flags != ENQUEUE_REPLENISH) was created, the flag was set to ENQUEUE_REPLENISH in rt_mutex_setprio(), now it is or-ed in. So the checking logic needs to change.

Fixes 1de64443d755 ("sched/core: Fix task and run queue sched_info::run_delay inconsistencies")
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/deadline.c +1 -1
index 1508d126e88b..f50d20b7fe7c 100644
@@ -1561,7 +1561,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 		 * the throttle.
 		 */
 		p->dl.dl_throttled = 0;
-		BUG_ON(!is_dl_boosted(&p->dl) || flags != ENQUEUE_REPLENISH);
+		BUG_ON(!is_dl_boosted(&p->dl) || !(flags & ENQUEUE_REPLENISH));
 		return;
 	}
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw

Hi,

Quoted 17 lines · On 06/02/21 12:48, [email protected] wrote:

From: Tom Rix <[email protected]>

When the BUG_ON check for (flags != ENQUEUE_REPLENISH) was created, the flag was set to ENQUEUE_REPLENISH in rt_mutex_setprio(), now it is or-ed in. So the checking logic needs to change.

Fixes 1de64443d755 ("sched/core: Fix task and run queue sched_info::run_delay inconsistencies")
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/deadline.c +0 -0
index 1508d126e88b..f50d20b7fe7c 100644

kernel/sched/deadline.c static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) · line 1564

Quoted 5 lines
kernel/sched/deadline.c +1 -1
@@ -1561,7 +1561,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 		 * the throttle.
 		 */
 		p->dl.dl_throttled = 0;
-		BUG_ON(!is_dl_boosted(&p->dl) || flags != ENQUEUE_REPLENISH);
+		BUG_ON(!is_dl_boosted(&p->dl) || !(flags & ENQUEUE_REPLENISH));

Uhu, isn't this actually the else branch of "if (is_dl_boosted())"? If yes, I don't see how this is not always triggering. :-/

Thanks,
Juri