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

Yuri Andriaccio posted 28 patches 8 hours ago
[RFC PATCH v4 27/28] [DEBUG] sched/rt: Add debug BUG_ONs for pre-migration code
Posted by Yuri Andriaccio 8 hours ago
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 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