Commit 1c09ab0d authored by Yong Zhang's avatar Yong Zhang Committed by Ingo Molnar
Browse files

sched: Skip autogroup when looking for all rt sched groups

Since commit ec514c48

 ("sched: Fix rt_rq runtime leakage bug")
'cat /proc/sched_debug' will print data of root_task_group.rt_rq
multiple times.

This is because autogroup does not have its own rt group, instead
rt group of autogroup is linked to root_task_group.

So skip it when we are looking for all rt sched groups, and it
will also save some noop operation against root_task_group when

-v2: Based on Cheng Xu's idea which uses less code.
Signed-off-by: default avatarYong Zhang <>
Cc: Mike Galbraith <>
Cc: Cheng Xu <>
Signed-off-by: default avatarPeter Zijlstra <>

Signed-off-by: default avatarIngo Molnar <>
parent 307bf980
......@@ -13,6 +13,7 @@ struct autogroup {
int nice;
static inline bool task_group_is_autogroup(struct task_group *tg);
static inline struct task_group *
autogroup_task_group(struct task_struct *p, struct task_group *tg);
......@@ -185,11 +185,23 @@ static inline u64 sched_rt_period(struct rt_rq *rt_rq)
typedef struct task_group *rt_rq_iter_t;
#define for_each_rt_rq(rt_rq, iter, rq) \
for (iter = list_entry_rcu(, typeof(*iter), list); \
(&iter->list != &task_groups) && \
(rt_rq = iter->rt_rq[cpu_of(rq)]); \
iter = list_entry_rcu(iter->, typeof(*iter), list))
static inline struct task_group *next_task_group(struct task_group *tg)
do {
tg = list_entry_rcu(tg->,
typeof(struct task_group), list);
} while (&tg->list != &task_groups && task_group_is_autogroup(tg));
if (&tg->list == &task_groups)
tg = NULL;
return tg;
#define for_each_rt_rq(rt_rq, iter, rq) \
for (iter = container_of(&task_groups, typeof(*iter), list); \
(iter = next_task_group(iter)) && \
(rt_rq = iter->rt_rq[cpu_of(rq)]);)
static inline void list_add_leaf_rt_rq(struct rt_rq *rt_rq)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment