Skip to contentSkip to conversation

remove the pointless BUG_ON(!task) from wake_up_q()

PATCH Applied Oleg Nesterov 2 participants 2 messages May 10, 2021 – May 12, 2021 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove the pointless BUG_ON(!task) from wake_up_q()

because it looks very confusing (to me at least). It is equivalent to BUG_ON(node == offsetof(struct task_struct, wake_q)), unlikely this is what we actually want to check.

---
 kernel/sched/core.c | 1 -
 1 file changed, 1 deletion(-)
kernel/sched/core.c +0 -1
index 5226cc26a095..61d1d85bb93d 100644
@@ -585,7 +585,6 @@ void wake_up_q(struct wake_q_head *head)
 		struct task_struct *task;
 
 		task = container_of(node, struct task_struct, wake_q);
-		BUG_ON(!task);
 		/* Task can safely be re-inserted now: */
 		node = node->next;
 		task->wake_q.next = NULL;
Signature · 1 line
2.25.1.362.g51ebf55
merge bot Applied
#1 lore raw

[tip: sched/core] sched/core: Remove the pointless BUG_ON(!task) from wake_up_q()

The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     2b8ca1a907d5fffc85fb648bbace28ddf3420825
Gitweb:        https://git.kernel.org/tip/2b8ca1a907d5fffc85fb648bbace28ddf3420825
Author:        Oleg Nesterov <[email protected]>
AuthorDate:    Mon, 10 May 2021 18:15:22 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Wed, 12 May 2021 11:03:54 +02:00

sched/core: Remove the pointless BUG_ON(!task) from wake_up_q()

container_of() can never return NULL - so don't check for it pointlessly.

[ mingo: Twiddled the changelog. ]

---
 kernel/sched/core.c | 1 -
 1 file changed, 1 deletion(-)
kernel/sched/core.c +0 -1
index 5226cc2..61d1d85 100644
@@ -585,7 +585,6 @@ void wake_up_q(struct wake_q_head *head)
 		struct task_struct *task;
 
 		task = container_of(node, struct task_struct, wake_q);
-		BUG_ON(!task);
 		/* Task can safely be re-inserted now: */
 		node = node->next;
 		task->wake_q.next = NULL;