Skip to content

Commit 6667517

Browse files
committed
Merge tag 'sched-urgent-2021-06-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fix from Ingo Molnar: "A last minute cgroup bandwidth scheduling fix for a recently introduced logic fail which triggered a kernel warning by LTP's cfs_bandwidth01 test" * tag 'sched-urgent-2021-06-24' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/fair: Ensure that the CFS parent is added after unthrottling
2 parents df50110 + fdaba61 commit 6667517

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

kernel/sched/fair.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,6 +3298,31 @@ static inline void cfs_rq_util_change(struct cfs_rq *cfs_rq, int flags)
32983298

32993299
#ifdef CONFIG_SMP
33003300
#ifdef CONFIG_FAIR_GROUP_SCHED
3301+
/*
3302+
* Because list_add_leaf_cfs_rq always places a child cfs_rq on the list
3303+
* immediately before a parent cfs_rq, and cfs_rqs are removed from the list
3304+
* bottom-up, we only have to test whether the cfs_rq before us on the list
3305+
* is our child.
3306+
* If cfs_rq is not on the list, test whether a child needs its to be added to
3307+
* connect a branch to the tree * (see list_add_leaf_cfs_rq() for details).
3308+
*/
3309+
static inline bool child_cfs_rq_on_list(struct cfs_rq *cfs_rq)
3310+
{
3311+
struct cfs_rq *prev_cfs_rq;
3312+
struct list_head *prev;
3313+
3314+
if (cfs_rq->on_list) {
3315+
prev = cfs_rq->leaf_cfs_rq_list.prev;
3316+
} else {
3317+
struct rq *rq = rq_of(cfs_rq);
3318+
3319+
prev = rq->tmp_alone_branch;
3320+
}
3321+
3322+
prev_cfs_rq = container_of(prev, struct cfs_rq, leaf_cfs_rq_list);
3323+
3324+
return (prev_cfs_rq->tg->parent == cfs_rq->tg);
3325+
}
33013326

33023327
static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
33033328
{
@@ -3313,6 +3338,9 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq)
33133338
if (cfs_rq->avg.runnable_sum)
33143339
return false;
33153340

3341+
if (child_cfs_rq_on_list(cfs_rq))
3342+
return false;
3343+
33163344
return true;
33173345
}
33183346

0 commit comments

Comments
 (0)