Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux-common: Add CFS_BANDWIDTH #35043

Merged
merged 1 commit into from Feb 21, 2018
Merged

Conversation

NeQuissimus
Copy link
Member

The option is needed to limit CPU usage of processes.
It seems to have no negative impact if left unused.

See https://lwn.net/Articles/428230/

Motivation for this change

I need this to limit Docker container resources:
https://docs.docker.com/config/containers/resource_constraints/#configure-the-default-cfs-scheduler

Since there seems to be no negative impact to people not using the functionality, I propose this be added to the common configuration.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

The option is needed to limit CPU usage of processes.
It seems to have no negative impact if left unused.

See https://lwn.net/Articles/428230/
@NeQuissimus
Copy link
Member Author

@GrahamcOfBorg test kernel-lts kernel-latest

@NeQuissimus
Copy link
Member Author

I may also need to undo #19251, so there may be more to it. I am currently testing this.

@NeQuissimus NeQuissimus changed the title linux-common: Add CFS_BANDWIDTH [WIP] linux-common: Add CFS_BANDWIDTH Feb 16, 2018
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

syncing
machine: running command: sync
machine: exit status 0
test script finished in 15.64s
cleaning up
killing machine (pid 627)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/l4ag3m8v593m16my3xfr1mdm02qbyg18-vm-test-run-kernel-lts
/nix/store/wlmqwgns85ypazds60ywi3vpq21571la-vm-test-run-kernel-latest

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

cannot build derivation ‘/nix/store/lrl4fmdrcjjfr1azywx10vy5hnbm4j6w-etc.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/0w17n7m8caycxrgcajdcaryyfxnjxrs9-stage-1-init.sh.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/zii7cfim5zqz6004i0v0ns27xjw2ca9m-initrd.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/c6q4i6d2yii2cgn0c7ab6q64pvw80bs6-nixos-system-machine-18.03.git.6c424b5.drv’: 5 dependencies couldn't be built
cannot build derivation ‘/nix/store/hrspwxjp0p576pgpnggwa1zfazg4vj61-closure-info.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/lhrg59yzgxxrcmrla0cjsvb25lz520pf-run-nixos-vm.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/cdh3lc6xybpi02p6ilhk5qgw6va4ak4j-nixos-vm.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/amfnwfd949c03fqas9cxfa0rm4l69q9a-nixos-test-driver-kernel-latest.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/19ckckq22dk06s67bri0zag1c99vw0w4-vm-test-run-kernel-latest.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/19ckckq22dk06s67bri0zag1c99vw0w4-vm-test-run-kernel-latest.drv’, ‘/nix/store/qsd3j48imrxcfv2dkzf0gm6iydknzacv-vm-test-run-kernel-lts.drv’ failed

@Mic92
Copy link
Member

Mic92 commented Feb 17, 2018

Does RT_GROUP_SCHED conflict with rtkit -> pulseaudio?

@NeQuissimus
Copy link
Member Author

@Mic92 Both pulseaudio and rtkit work just fine after applying the kernel change.

@NeQuissimus NeQuissimus changed the title [WIP] linux-common: Add CFS_BANDWIDTH linux-common: Add CFS_BANDWIDTH Feb 21, 2018
@Mic92
Copy link
Member

Mic92 commented Feb 21, 2018

@NeQuissimus they probably still function, but does it impact userland realtime scheduling?

@NeQuissimus
Copy link
Member Author

Not sure how to make sure of that.

@Mic92
Copy link
Member

Mic92 commented Feb 21, 2018

@NeQuissimus the option should be fine. Overhead is nearly unmeasurable even in synthetic benchmarks.
I also checked that both Ubuntu and Archlinux have that flag enabled.

@NeQuissimus NeQuissimus merged commit 09cc887 into NixOS:master Feb 21, 2018
@NeQuissimus NeQuissimus deleted the cfs_bandwidth branch February 21, 2018 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants