]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
sched/fair: Fix O(nr_cgroups) in load balance path
authorTejun Heo <tj@kernel.org>
Wed, 7 Feb 2018 12:06:00 +0000 (13:06 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 13 Mar 2018 10:47:57 +0000 (11:47 +0100)
commitb735a872ab8c3cb1786925ce9f71bd1fd062443e
treeba2fb8cf859b025b59d14bc467c37c8b3b212ed5
parent96fb9ee9f7d5348691ecc874fbde662720a0f949
sched/fair: Fix O(nr_cgroups) in load balance path

BugLink: https://bugs.launchpad.net/bugs/1747896
Currently, rq->leaf_cfs_rq_list is a traversal ordered list of all
live cfs_rqs which have ever been active on the CPU; unfortunately,
this makes update_blocked_averages() O(# total cgroups) which isn't
scalable at all.

This shows up as a small CPU consumption and scheduling latency
increase in the load balancing path in systems with CPU controller
enabled across most cgroups.  In an edge case where temporary cgroups
were leaking, this caused the kernel to consume good several tens of
percents of CPU cycles running update_blocked_averages(), each run
taking multiple millisecs.

This patch fixes the issue by taking empty and fully decayed cfs_rqs
off the rq->leaf_cfs_rq_list.

Signed-off-by: Tejun Heo <tj@kernel.org>
[ Added cfs_rq_is_decayed() ]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Chris Mason <clm@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170426004350.GB3222@wtj.duckdns.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(backported from commit a9e7f6544b9cebdae54d29f87a7ba2a83c0471b5)
Signed-off-by: Gavin Guo <gavin.guo@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
kernel/sched/fair.c