sched/rt: Sum number of all children tasks in hierarhy at rt_nr_running
Quoted 33 lines · Kirill Tkhai
Quoted 32 lines
18.03.2014, 15:08, "Preeti Murthy" <[email protected]>:
Quoted 7 lines · Kirill Tkhai
Quoted 4 lines
{inc,dec}_rt_tasks used to count entities which are directly queued on
rt_rq. If an entity was not a task (i.e., it is some queue), its children were not counted.Its always the case that a task is queued right, never a sched entity?
With patch applied, when sched entity is group queue, we add number of its child tasks instead of "1".
Quoted 2 lines
When a task is queued, the
nr_runningof everyrt_rqin the hierarchy of sched entities which are parents of this task is incremented by 1.Only if they had not had a queued task before.
Quoted 7 lines
Similar is with dequeue of a
sched_entity. If thesched_entityhas just 1 task on it, then its dequeued from its parent queue and its number decremented for every rq in the hierarchy. But you would never dequeue asched_entityif it has more than 1 task in it. The granularity of enqueue and dequeue ofsched_entitiesis one task at a time. You can extend this to enqueue and dequeue of asched_entityonly if it has just one task in its queue.We do not queue entites, which are empty. In
__enqueue_rt_entity():if (
group_rq&& (rt_rq_throttled(group_rq)|| !group_rq->rt_nr_running)) return;
Quoted 7 lines
Quoted 1 line
Where do you see a collision? Please explain, if so.
Ok I went through the patchset more closely and I understand it better now. So this patchset targets the throttled rt runqueues specifically. I am sorry I missed this focal point. So this patch looks good to me.
Reviewed-by Preeti U Murthy <[email protected]>
Thanks, Preeti!
Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
Regards
Preeti U MurthyQuoted 51 lines
There is no problem here, but now we want to count number of all tasks which are actually queued under the
rt_rqin all the hierarhy (except throttled rt queues).Empty queues are not able to be queued and all of the places, which use
rt_nr_running, just compare it with zero, so we do not break anything here.Signed-off-by Kirill Tkhai <[email protected]>CC Peter Zijlstra <[email protected]>CC Ingo Molnar <[email protected]>---
kernel/sched/rt.c| 15 +++++++++++++--1 file changed, 13 insertions(+), 2 deletions(-)kernel/sched/rt.c +0
-0@@ -1045,12 +1045,23 @@ void dec_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}#endif /* CONFIG_RT_GROUP_SCHED */ static inline
kernel/sched/rt.c +11
-0+unsigned int rt_se_nr_running (struct sched_rt_entity *rt_se) +{ +struct rt_rq *group_rq =group_rt_rq (rt_se); + +if (group_rq) +return group_rq->rt_nr_running; +else +return 1 ; +} + +static inlinevoid
inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq){
int prio =rt_se_prio(rt_se);WARN_ON(!rt_prio(prio));
- rt_rq->rt_nr_running++;
+rt_rq->rt_nr_running+=rt_se_nr_running(rt_se);
inc_rt_prio(rt_rq, prio);inc_rt_migration(rt_se, rt_rq);kernel/sched/rt.c +1
-1@@ -1062,7 +1073,7 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {WARN_ON (!rt_prio (rt_se_prio (rt_se)));WARN_ON (!rt_rq->rt_nr_running); - rt_rq->rt_nr_running--; + rt_rq->rt_nr_running -=rt_se_nr_running (rt_se);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
kernel/sched/rt.c +0
-1dec_rt_prio (rt_rq,rt_se_prio (rt_se));dec_rt_migration (rt_se, rt_rq); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--