Skip to content

Commit 22abdef

Browse files
tkhaiIngo Molnar
authored andcommitted
sched/rt: Sum number of all children tasks in hierarhy at ->rt_nr_running
{inc,dec}_rt_tasks() used to count entities which are directly queued on the rt_rq. If an entity was not a task (i.e., it is some queue), its children were not counted. There is no problem here, but now we want to count number of all tasks which are actually queued under the rt_rq in all the hierarchy (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 <tkhai@yandex.ru> Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1394835289.18748.31.camel@HP-250-G1-Notebook-PC Cc: linux-kernel@vger.kernel.org [ Twiddled the changelog. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 8698a74 commit 22abdef

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

kernel/sched/rt.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,13 +1044,24 @@ void dec_rt_group(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq) {}
10441044

10451045
#endif /* CONFIG_RT_GROUP_SCHED */
10461046

1047+
static inline
1048+
unsigned int rt_se_nr_running(struct sched_rt_entity *rt_se)
1049+
{
1050+
struct rt_rq *group_rq = group_rt_rq(rt_se);
1051+
1052+
if (group_rq)
1053+
return group_rq->rt_nr_running;
1054+
else
1055+
return 1;
1056+
}
1057+
10471058
static inline
10481059
void inc_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
10491060
{
10501061
int prio = rt_se_prio(rt_se);
10511062

10521063
WARN_ON(!rt_prio(prio));
1053-
rt_rq->rt_nr_running++;
1064+
rt_rq->rt_nr_running += rt_se_nr_running(rt_se);
10541065

10551066
inc_rt_prio(rt_rq, prio);
10561067
inc_rt_migration(rt_se, rt_rq);
@@ -1062,7 +1073,7 @@ void dec_rt_tasks(struct sched_rt_entity *rt_se, struct rt_rq *rt_rq)
10621073
{
10631074
WARN_ON(!rt_prio(rt_se_prio(rt_se)));
10641075
WARN_ON(!rt_rq->rt_nr_running);
1065-
rt_rq->rt_nr_running--;
1076+
rt_rq->rt_nr_running -= rt_se_nr_running(rt_se);
10661077

10671078
dec_rt_prio(rt_rq, rt_se_prio(rt_se));
10681079
dec_rt_migration(rt_se, rt_rq);

0 commit comments

Comments
 (0)