Skip to contentSkip to conversation

sched/rt: Do not try to push tasks if pinned task switches to RT

PATCH In review Kirill Tkhai 3 participants 3 messages Jan 28, 2013 – Jan 29, 2013 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/rt: Do not try to push tasks if pinned task switches to RT

Just switched pinned task is not able to be pushed. If the rq had had several RT tasks before they have already been considered as candidates to be pushed (or pulled).

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC linux-rt-users <[email protected]>
---
 kernel/sched/rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/rt.c +2 -2
index 4e8f0f4..5f7d92b 100644
@@ -1925,9 +1925,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
 	 */
 	if (p->on_rq && rq->curr != p) {
 #ifdef CONFIG_SMP
-		if (rq->rt.overloaded && push_rt_task(rq) &&
+		if (rq->rt.overloaded && p->nr_cpus_allowed > 1 &&
 		    /* Don't resched if we changed runqueues */
-		    rq != task_rq(p))
+		    push_rt_task(rq) && rq != task_rq(p))
 			check_resched = 0;
 #endif /* CONFIG_SMP */
 		if (check_resched && p->prio < rq->curr->prio)
#1 lore raw

From: Libo Chen <[email protected]>

Quoted 17 lines · Kirill Tkhai

Just switched pinned task is not able to be pushed. If the rq had had several RT tasks before they have already been considered as candidates to be pushed (or pulled).

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC linux-rt-users <[email protected]>
---
 kernel/sched/rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/rt.c +0 -0
index 4e8f0f4..5f7d92b 100644

kernel/sched/rt.c static void switched_to_rt(struct rq *rq, struct task_struct *p) · line 1930

Quoted 8 lines
kernel/sched/rt.c +2 -2
@@ -1925,9 +1925,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
 	 */
 	if (p->on_rq && rq->curr != p) {
 #ifdef CONFIG_SMP
-		if (rq->rt.overloaded && push_rt_task(rq) &&
+		if (rq->rt.overloaded && p->nr_cpus_allowed > 1 &&
 		    /* Don't resched if we changed runqueues */
-		    rq != task_rq(p))
+		    push_rt_task(rq) && rq != task_rq(p))

I think you worry about it was excess to call push_rt_task, since the task of p->nr_cpus_allowed=1 can`t be pushed. is that right?

The task of p->nr_cpus_allowed =1 would`t be added to pushable_tasks list (see the enqueue_task_rt())and this push_rt_task() need to push other tasks when rt.overloaded.

So I don`t agree this patch.

Quoted 8 lines
kernel/sched/rt.c +0 -1
 			check_resched = 0;
 #endif /* CONFIG_SMP */
 		if (check_resched && p->prio < rq->curr->prio)
--

To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Kirill Tkhai
Quoted 3 lines · Kirill Tkhai

Just switched pinned task is not able to be pushed. If the rq had had several RT tasks before they have already been considered as candidates to be pushed (or pulled).

Thanks, but I have one minor nit.

Quoted 14 lines
CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
CC linux-rt-users <[email protected]>
---
 kernel/sched/rt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/rt.c +0 -0
index 4e8f0f4..5f7d92b 100644

kernel/sched/rt.c static void switched_to_rt(struct rq *rq, struct task_struct *p) · line 1928

Quoted 5 lines
kernel/sched/rt.c +1 -1
@@ -1925,9 +1925,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
 	 */
 	if (p->on_rq && rq->curr != p) {
 #ifdef CONFIG_SMP
-		if (rq->rt.overloaded && push_rt_task(rq) &&
+		if (rq->rt.overloaded && p->nr_cpus_allowed > 1 &&

I would swap the order here. That is, check p->nr_cpus_allowed before rq->rt.overloaded. The order doesn't really matter, and even though rq->rt.overloaded is probably more likely to be 0, it is used by other CPUs. And as a micro-optimization, I rather read something that is used by only one CPU than to read something that may be modified by many CPUs.

-- Steve

Quoted 6 lines
kernel/sched/rt.c +1 -1
 		    /* Don't resched if we changed runqueues */
-		    rq != task_rq(p))
+		    push_rt_task(rq) && rq != task_rq(p))
 			check_resched = 0;
 #endif /* CONFIG_SMP */
 		if (check_resched && p->prio < rq->curr->prio)