[RFC 33/60] cosched: Allow resched_curr() to be called for hierarchical runqueues

From: Jan H. SchÃnherr
Date: Fri Sep 07 2018 - 17:46:25 EST


The function resched_curr() kicks the scheduler for a certain runqueue,
assuming that the runqueue is already locked.

If called for a hierarchical runqueue, the equivalent operation is to
kick the leader. Unfortunately, we don't know whether we also hold
the CPU runqueue lock at this point, which is needed for resched_curr()
to work. Therefore, fall back to resched_cpu_locked() on higher levels.

Signed-off-by: Jan H. SchÃnherr <jschoenh@xxxxxxxxx>
---
kernel/sched/core.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 337bae6fa836..c4358396f588 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -457,6 +457,11 @@ void resched_curr(struct rq *rq)

lockdep_assert_held(&rq->lock);

+#ifdef CONFIG_COSCHEDULING
+ if (rq->sdrq_data.level)
+ return resched_cpu_locked(rq->sdrq_data.leader);
+#endif
+
if (test_tsk_need_resched(curr))
return;

--
2.9.3.1.gcba166c.dirty