Patch "sched/fair: Initialize throttle_count for new task-groups lazily" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
sched/fair: Initialize throttle_count for new task-groups lazily
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
sched-fair-initialize-throttle_count-for-new-task-groups-lazily.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
094f469172e00d6ab0a3130b0e01c83b3cf3a98dMon Sep 17 00:00:00 2001
From: Konstantin Khlebnikov <[email protected]>
Date: Thu, 16 Jun 2016 15:57:01 +0300
Subject: sched/fair: Initialize throttle_count for new task-groups lazily
From: Konstantin Khlebnikov <[email protected]>
commit 094f469172e00d6ab0a3130b0e01c83b3cf3a98d upstream.
Cgroup created inside throttled group must inherit current throttle_count. Broken throttle_count allows to nominate throttled entries as a next buddy, later this leads to null pointer dereference in pick_next_task_fair().
This patch initialize cfs_rq->throttle_count at first enqueue: laziness allows to skip locking all rq at group creation. Lazy approach also allows to skip full sub-tree scan at throttling hierarchy (not in this patch).
--- kernel/sched/fair.c | 20 ++++++++++++++++++++ kernel/sched/sched.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-)
kernel/sched/fair.c +20 -0
@@ -3918,6 +3918,26 @@ static void check_enqueue_throttle(strucif (!cfs_bandwidth_used ())return ; +/* Synchronize hierarchical throttle counter: */ +if (unlikely (!cfs_rq->throttle_uptodate)) { +struct rq *rq =rq_of (cfs_rq); +struct cfs_rq *pcfs_rq; +struct task_group *tg; + + cfs_rq->throttle_uptodate =1 ; + +/* Get closest up-to-date node, because leaves go first: */ +for (tg = cfs_rq->tg->parent; tg; tg = tg->parent) { + pcfs_rq = tg->cfs_rq[cpu_of (rq)]; +if (pcfs_rq->throttle_uptodate) +break ; + } +if (tg) { + cfs_rq->throttle_count = pcfs_rq->throttle_count; + cfs_rq->throttled_clock_task =rq_clock_task (rq); + } + } +/* an active group must be handled by the update_curr()->put() path */ if (!cfs_rq->runtime_enabled || cfs_rq->curr)return ;
kernel/sched/sched.h +1 -1
@@ -417,7 +417,7 @@ struct cfs_rq {u64 throttled_clock, throttled_clock_task;u64 throttled_clock_task_time; -int throttled, throttle_count; +int throttled, throttle_count, throttle_uptodate;struct list_head throttled_list;#endif /* CONFIG_CFS_BANDWIDTH */ #endif /* CONFIG_FAIR_GROUP_SCHED */
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/sched-fair-do-not-announce-throttled-next-buddy-in-dequeue_task_fair.patch queue-4.4/sched-fair-initialize-throttle_count-for-new-task-groups-lazily.patch