sched/rt: Do not try to push tasks if pinned task switches to RT
Quoted 34 lines · Kirill Tkhai
Quoted 4 lines
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 13 lines
Signed-off-by Kirill V Tkhai <[email protected]>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
-0kernel/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_allowedbeforerq->rt.overloaded. The order doesn't really matter, and even thoughrq->rt.overloadedis 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.
Quoted 2 lines
-- Steve
I corrected. Thanks.
[PATCH]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).
--- kernel/sched/rt.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
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 (p->nr_cpus_allowed >1 && rq->rt.overloaded &&/* 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)
Peter,
I'm going through my inbox (over a year old), and found this patch from Kirill. It looks fine to me. You can apply it with my
-- Steve
[PATCH]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).
--- kernel/sched/rt.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
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 (p->nr_cpus_allowed >1 && rq->rt.overloaded &&/* 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)
Quoted 29 lines · Steven Rostedt
Peter,
I'm going through my inbox (over a year old), and found this patch from Kirill. It looks fine to me. You can apply it with my
Acked-by Steven Rostedt <[email protected]>-- Steve
[PATCH]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).
Signed-off-by Kirill V Tkhai <[email protected]>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 files changed, 2 insertions(+), 2 deletions(-)kernel/sched/rt.c +0
-0@@ -1925,9 +1925,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)*/
kernel/sched/rt.c static void switched_to_rt(struct rq *rq, struct task_struct *p) · line 1933
Quoted 10 lines
kernel/sched/rt.c +2
-2if (p->on_rq && rq->curr != p) {#ifdef CONFIG_SMP -if (rq->rt.overloaded &&push_rt_task (rq) && +if (p->nr_cpus_allowed >1 && rq->rt.overloaded &&/* 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)
would there not need to be a check for p->migrate_disable ? push_rt_task() is not checking and so a high prio RT task preemting a low prio RT task in a migrate_disable() section would actually push it off this cpu ? atleast I did not find why that would not happen.
thx!
hofrat
12.03.2014, 14:39, "Nicholas Mc Guire" <[email protected]>:
Quoted 42 lines · Steven Rostedt
Quoted 24 lines
Peter,
I'm going through my inbox (over a year old), and found this patch from Kirill. It looks fine to me. You can apply it with my
Acked-by Steven Rostedt <[email protected]>-- Steve
[PATCH]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).
Signed-off-by Kirill V Tkhai <[email protected]>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 files changed, 2 insertions(+), 2 deletions(-)Quoted 16 lines
diff --git
a/kernel/sched/rt.cb/kernel/sched/rt.c
index 4e8f0f4..5aab032 100644
---a/kernel/sched/rt.c
+++b/kernel/sched/rt.c
@@ -1925,9 +1925,9 @@ static voidswitched_to_rt(struct rq *rq, struct task_struct *p)*/
if (p->on_rq&&rq->curr!= p) {
#ifdefCONFIG_SMP
- if (rq->rt.overloaded&&push_rt_task(rq)&&
+ if (p->nr_cpus_allowed> 1 &&rq->rt.overloaded&&
/* 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)
Quoted 5 lines
would there not need to be a check for
p->migrate_disable?push_rt_task()is not checking and so a high prio RT task preemting a low prio RT task in amigrate_disable()section would actually push it off this cpu ? atleast I did not find why that would not happen.
Hi, Nicholas!
p is not rq->curr, so its p->migrate_disable state is already updated and it can't be pushed (nr_cpus_allowed == 1 and it's not pushable).
(If I understand right, that you worry about this).
Kirill
Quoted 2 lines
thx!
hofrat
Steven Rostedt
reviewerQuoted 6 lines · On Wed, 12 Mar 2014 16:23:48 +0400 Kirill Tkhai <[email protected]> wrote:
Quoted 5 lines
would there not need to be a check for
p->migrate_disable?push_rt_task()is not checking and so a high prio RT task preemting a low prio RT task in amigrate_disable()section would actually push it off this cpu ? atleast I did not find why that would not happen.
Quoted 7 lines
Hi, Nicholas!
p is not
rq->curr, so itsp->migrate_disablestate is already updated and it can't be pushed (nr_cpus_allowed== 1 and it's not pushable).(If I understand right, that you worry about this).
Correct. If p has migrate_disabled set and scheduled out, then when it gets scheduled out, its cpu affinity gets set to only the current cpu and nr_cpu_allowed to 1. No need to check here if p->migrate_disabled is set.
-- Steve
Peter Zijlstra
maintainerQuoted 5 lines · Steven Rostedt
Peter,
I'm going through my inbox (over a year old), and found this patch from Kirill. It looks fine to me. You can apply it with my
Thanks!
tip-bot for Kirill V Tkhai
merge botsched/rt: Do not try to push tasks if pinned task switches to RT
Commit-ID: 10447917551e0fffb8d1892d46e633c3e0a9c1ec Gitweb: http://git.kernel.org/tip/10447917551e0fffb8d1892d46e633c3e0a9c1ec Author: Kirill V Tkhai <[email protected]> AuthorDate: Wed, 12 Mar 2014 06:18:33 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 18 Apr 2014 12:07:23 +0200
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).
--- kernel/sched/rt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/rt.c +2 -2
@@ -1892,9 +1892,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 (p->nr_cpus_allowed >1 && rq->rt.overloaded &&/* 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)