Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 637056 - sys-kernel/gentoo-sources cgroup-v2-cpu patches
Summary: sys-kernel/gentoo-sources cgroup-v2-cpu patches
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-10 15:17 UTC by Leonard Lausen
Modified: 2017-12-07 15:15 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leonard Lausen 2017-11-10 15:17:44 UTC
Unfortunately there has been no consensus on the cgroup-v2-cpu controller and it hasn't been merged to mainline. It allows limiting CPU ressources via cgroups. While it is not in mainline systemd provides functionality that relies on the cgroup-v2-cpu.

The background is described in https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/tree/Documentation/cgroup-v2-cpu.txt?h=cgroup-v2-cpu

Quoting the summary for easy reference:

> All objections from the scheduler maintainers apply to cgroup v2 core
> design, and there are no known objections to the specifics of the CPU
> controller cgroup v2 interface.  The only blocked part is changes to
> expose the CPU controller interface on cgroup v2, which comprises the
> following two patches:
> 
> [1] sched: Misc preps for cgroup unified hierarchy interface
> [2] sched: Implement interface for cgroup unified hierarchy
> 
> The necessary changes are superficial and implement the interface
> files on cgroup v2.  The combined diffstat is as follows.
> 
> kernel/sched/core.c    |  149 +++++++++++++++++++++++++++++++++++++++++++++++--
> kernel/sched/cpuacct.c |   57 ++++++++++++------
> kernel/sched/cpuacct.h |    5 +
> 3 files changed, 189 insertions(+), 22 deletions(-)
> 
> The patches are easy to apply and forward-port.  The following git
> branch will always carry the two patches on top of the latest release
> of the upstream kernel.
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu
> 
> There also are versioned branches going back to v4.4.
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu-$KERNEL_VER
> 
> While it's difficult to tell whether the CPU controller support will
> be merged, there are crucial resource control features in cgroup v2
> that are only possible due to the design choices that are being
> objected to, and every effort will be made to ease enabling the CPU
> controller cgroup v2 support out-of-tree for parties which choose to.

Applying these patches would for example allow to limit CPU usage of emerge easily using systemd-run.

> sudo systemd-run -p CPUWeight=X emerge --ask --newuse --update --deep @world 

And finally, judging from the paragraph below there seem to be no downsides with enabling these patches:

> Finally, it's important to note that enabling cgroup v2 support for
> the CPU controller doesn't block use cases which require the features
> which are not available on cgroup v2.  Unlikely, but should anybody
> actually rely on the CPU controller's symmetric handling of tasks and
> cgroups, backward compatibility is and will be maintained by being
> able to disconnect the controller from the cgroup v2 hierarchy and use
> it standalone.  This also holds for cpuset which is often used in
> highly customized configurations which might be a poor fit for common
> resource domains.
Comment 1 Mike Pagano gentoo-dev 2017-11-10 20:11:18 UTC
Is there a complete defined patchset somewhere?
Comment 2 Leonard Lausen 2017-11-11 01:01:29 UTC
Does 

> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu
> 
> There also are versioned branches going back to v4.4.
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/cgroup-v2-cpu-$KERNEL_VER

qualify as complete defined patchset? Or would you like to get a patch file? It should be straightforward to get via 'git format-patch', but I'm not sure if it is available online. Would it be an option to run some scripts to create it?
Comment 3 Alice Ferrazzi Gentoo Infrastructure gentoo-dev 2017-12-07 04:10:10 UTC
looks like a candidate for experimental
Comment 4 Leonard Lausen 2017-12-07 15:15:54 UTC
This was merged for 4.15 https://lwn.net/Articles/739341/ .