UPSTREAM: sched/fair: Initialize throttle_count for new task-groups lazily

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).

Signed-off-by: Konstantin Khlebnikov <>
Signed-off-by: Peter Zijlstra (Intel) <>
Cc: Linus Torvalds <>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Signed-off-by: Ingo Molnar <>
Signed-off-by: Andrey Ulanov <>

(cherry-picked from commit 094f469172e00d6ab0a3130b0e01c83b3cf3a98d)

TEST=kernel compiles

Change-Id: I4b39f8ea3ff951fc59807b50c1bddde241c53efd
Commit-Ready: Andrey Ulanov <>
Tested-by: Andrey Ulanov <>
Reviewed-by: Guenter Roeck <>
(cherry picked from commit 43966ab2563e2df7cd0434350ee01d26ecaa615c)
Commit-Queue: Andrey Ulanov <>
2 files changed