[RFC PATCH v5 28/29] sched/rt: Add debug BUG_ONs for pre-migration code

Yuri Andriaccio
2026-04-30T21:39:27Z

Add debug BUG_ONs in rt_queue_push/pull_task(s).
Can be safely added after all the pre-migration patches.

These are extra asserts which are only useful to debug the kernel code and
are not meant to be part of the final patchset.

Signed-off-by: Yuri Andriaccio <yurand2000@gmail.com>
---
kernel/sched/rt.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4553a139398f..6cecda2ce812 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -340,6 +340,9 @@ static inline void rt_queue_push_tasks(struct rt_rq *rt_rq)
{
struct rq *rq = served_rq_of_rt_rq(rt_rq);

+ BUG_ON(rt_rq == NULL);
+ BUG_ON(rq != cpu_rq(rq->cpu));
+
if (!has_pushable_tasks(rt_rq))
return;

@@ -350,6 +353,9 @@ static inline void rt_queue_pull_task(struct rt_rq *rt_rq)
{
struct rq *rq = served_rq_of_rt_rq(rt_rq);

+ BUG_ON(rt_rq == NULL);
+ BUG_ON(rq != cpu_rq(rq->cpu));
+
queue_balance_callback(rq, &per_cpu(rt_pull_head, rq->cpu), pull_rt_task);
}

--
2.53.0