* [PATCH] sched: find all lowest run-queues for RT task
@ 2011-06-03 14:11 Hillf Danton
2011-06-16 16:52 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Hillf Danton @ 2011-06-03 14:11 UTC (permalink / raw)
To: LKML
Cc: Steven Rostedt, Mike Galbraith, Yong Zhang, Peter Zijlstra, Ingo Molnar
When finding the lowest run-queue for a given RT task, as seen in cases such as
select_task_rq_rt() and find_lock_lowest_rq(), RQs with no RT tasks are also
eligible for both RR and FIFO RT tasks.
Minor change is added, when initializing cpupri, to record non-RT RQs which are
upated automatically, due to the cool design and implementation of cpupri, when
RT RQs are set and unset. Then they could be included in the selected CPUs by
cpupri_find().
A call for cpupri_set() is also added when a RQ has no RT task to run.
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
kernel/sched_cpupri.c | 4 +++-
kernel/sched_rt.c | 4 ++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c
index 2722dc1..d4c0b46 100644
--- a/kernel/sched_cpupri.c
+++ b/kernel/sched_cpupri.c
@@ -181,8 +181,10 @@ int cpupri_init(struct cpupri *cp)
goto cleanup;
}
- for_each_possible_cpu(i)
+ for_each_possible_cpu(i) {
cp->cpu_to_pri[i] = CPUPRI_INVALID;
+ cpupri_set(cp, i, MAX_RT_PRIO);
+ }
return 0;
cleanup:
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 88725c9..4dd6e45 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1158,6 +1158,10 @@ static struct task_struct
*pick_next_task_rt(struct rq *rq)
* lock again later if there is no need to push
*/
rq->post_schedule = has_pushable_tasks(rq);
+
+ /* this CPU is no longer RT if no task picked to feed it */
+ if (! p)
+ cpupri_set(&rq->rd->cpupri, rq->cpu, MAX_RT_PRIO);
#endif
return p;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: find all lowest run-queues for RT task
2011-06-03 14:11 [PATCH] sched: find all lowest run-queues for RT task Hillf Danton
@ 2011-06-16 16:52 ` Steven Rostedt
2011-06-16 16:57 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2011-06-16 16:52 UTC (permalink / raw)
To: Hillf Danton
Cc: LKML, Mike Galbraith, Yong Zhang, Peter Zijlstra, Ingo Molnar
On Fri, 2011-06-03 at 22:11 +0800, Hillf Danton wrote:
> When finding the lowest run-queue for a given RT task, as seen in cases such as
> select_task_rq_rt() and find_lock_lowest_rq(), RQs with no RT tasks are also
> eligible for both RR and FIFO RT tasks.
>
> Minor change is added, when initializing cpupri, to record non-RT RQs which are
> upated automatically, due to the cool design and implementation of cpupri, when
> RT RQs are set and unset. Then they could be included in the selected CPUs by
> cpupri_find().
>
> A call for cpupri_set() is also added when a RQ has no RT task to run.
I just analyzed the code, and only the first part of the patch seems OK.
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> kernel/sched_cpupri.c | 4 +++-
> kernel/sched_rt.c | 4 ++++
> 2 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c
> index 2722dc1..d4c0b46 100644
> --- a/kernel/sched_cpupri.c
> +++ b/kernel/sched_cpupri.c
> @@ -181,8 +181,10 @@ int cpupri_init(struct cpupri *cp)
> goto cleanup;
> }
>
> - for_each_possible_cpu(i)
> + for_each_possible_cpu(i) {
> cp->cpu_to_pri[i] = CPUPRI_INVALID;
> + cpupri_set(cp, i, MAX_RT_PRIO);
> + }
This is OK, and I may add it. It's just an initialization, and because
things like the migration thread run on all CPUs, the first time an RT
task is run on a CPU and dequeued, it will have the cpupri_set() to
MX_RT_PRIO anyway. But for clean up sake, it may be good to initialize
it to a valid mask and not be ZERO.
> return 0;
>
> cleanup:
> diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
> index 88725c9..4dd6e45 100644
> --- a/kernel/sched_rt.c
> +++ b/kernel/sched_rt.c
> @@ -1158,6 +1158,10 @@ static struct task_struct
> *pick_next_task_rt(struct rq *rq)
> * lock again later if there is no need to push
> */
> rq->post_schedule = has_pushable_tasks(rq);
> +
> + /* this CPU is no longer RT if no task picked to feed it */
> + if (! p)
> + cpupri_set(&rq->rd->cpupri, rq->cpu, MAX_RT_PRIO);
Now this is where things are not needed, because when we dequeue the
last RT task, this is already done by the dequeue code.
-- Steve
> #endif
>
> return p;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: find all lowest run-queues for RT task
2011-06-16 16:52 ` Steven Rostedt
@ 2011-06-16 16:57 ` Steven Rostedt
0 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2011-06-16 16:57 UTC (permalink / raw)
To: Hillf Danton
Cc: LKML, Mike Galbraith, Yong Zhang, Peter Zijlstra, Ingo Molnar
On Thu, 2011-06-16 at 12:52 -0400, Steven Rostedt wrote:
> > diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c
> > index 2722dc1..d4c0b46 100644
> > --- a/kernel/sched_cpupri.c
> > +++ b/kernel/sched_cpupri.c
> > @@ -181,8 +181,10 @@ int cpupri_init(struct cpupri *cp)
> > goto cleanup;
> > }
> >
> > - for_each_possible_cpu(i)
> > + for_each_possible_cpu(i) {
> > cp->cpu_to_pri[i] = CPUPRI_INVALID;
> > + cpupri_set(cp, i, MAX_RT_PRIO);
> > + }
>
> This is OK, and I may add it. It's just an initialization, and because
> things like the migration thread run on all CPUs, the first time an RT
> task is run on a CPU and dequeued, it will have the cpupri_set() to
> MX_RT_PRIO anyway. But for clean up sake, it may be good to initialize
> it to a valid mask and not be ZERO.
>
I take it back, this isn't needed either, as the cpupri_set() is
initialized when the rq comes on line.
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-16 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03 14:11 [PATCH] sched: find all lowest run-queues for RT task Hillf Danton
2011-06-16 16:52 ` Steven Rostedt
2011-06-16 16:57 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®