[RFC PATCH v4 27/28] [DEBUG] sched/rt: Add debug BUG_ONs for pre-migration code

From: Yuri Andriaccio
Date: Mon Dec 01 2025 - 07:49:07 EST


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@xxxxxxxxx>
---
kernel/sched/rt.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 80580b48ab..435d147aa5 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -319,6 +319,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;

@@ -329,6 +332,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.51.0