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 config: Set TCP_CONG_CUBIC=yes to restore the default #81500

Merged
merged 1 commit into from Apr 6, 2020

Conversation

primeos
Copy link
Member

@primeos primeos commented Mar 2, 2020

This will switch the default TCP congestion control algorithm from
new Reno to CUBIC. CUBIC is the default since Linux kernel 2.6.19
(see 597811ec167fa) and most (all?) distributions keep this default
(e.g. Debian and Ubuntu). On NixOS the default was still new Reno
because generate-config.pl changes TCP_CONG_CUBIC from y to m (since we
try to build everything as a module by default).

To check the active and available algorithms:
$ sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = cubic
$ sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = cubic reno

Note: E.g. x86_64_defconfig sets TCP_CONG_CUBIC=y indirectly via
CONFIG_TCP_CONG_ADVANCED=y (but CUBIC is also the default if set to no,
see net/ipv4/Kconfig).

Edit: Some existing diffs (old NixOS kernel configuration vs. other distributions):
- Ubuntu: https://github.com/NixOS/nixpkgs/issues/58275#issuecomment-477203331
- Arch: https://github.com/NixOS/nixpkgs/issues/39225#issuecomment-385281048
Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This will switch the default TCP congestion control algorithm from
new Reno to CUBIC. CUBIC is the default since Linux kernel 2.6.19
(see 597811ec167fa) and most (all?) distributions keep this default
(e.g. Debian and Ubuntu). On NixOS the default was still new Reno
because generate-config.pl changes TCP_CONG_CUBIC from y to m (since we
try to build everything as a module by default).

To check the active and available algorithms:
$ sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = cubic
$ sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = cubic reno

Note: E.g. x86_64_defconfig sets TCP_CONG_CUBIC=y indirectly via
CONFIG_TCP_CONG_ADVANCED=y (but CUBIC is also the default if set to no,
see net/ipv4/Kconfig).
@teto
Copy link
Member

teto commented Mar 2, 2020

I think you want to set DEFAULT_CUBIC instead since we dont care if it is builtin or module.

@primeos
Copy link
Member Author

primeos commented Mar 2, 2020

I think you want to set DEFAULT_CUBIC instead since we dont care if it is builtin or module.

No, that wasn't my intention but I didn't check if that would work as well (i.e. automatically load the module - this might not work and especially at early boot it wouldn't). The upstream default is TCP_CONG_CUBIC=y (via CONFIG_TCP_CONG_ADVANCED=y on x86_64) which automatically propagates DEFAULT_CUBIC=y and DEFAULT_TCP_CONG="cubic" (and this is e.g. also what Debian and Ubuntu do). Additionally I don't see a real advantage of using a module here (since we'd have to always load it anyway).

@FRidh FRidh added this to WIP in Staging via automation Mar 6, 2020
@FRidh FRidh moved this from WIP to Needs review in Staging Mar 6, 2020
Copy link
Member

@Emantor Emantor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked Arch Linux and Debian, they indeed do it this way.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/127

@primeos
Copy link
Member Author

primeos commented Apr 6, 2020

@Emantor thank you very much for your review! :)

@edolstra @NeQuissimus @dezgeg (pkgs/os-specific/linux/kernel/common-config.nix) and
@fpletz @aszlig (network related topics?): Could one of you maybe give this a quick look?

My main motivation for this PR is to stick to the upstream default. I didn't have a closer look at benchmarks (which is probably difficult anyway as this depends a lot on the setup, usage, and goals (e.g. latency vs. speed)). But for a normal user this change should be completely transparent. If desired I could also write a release notes entry, I'm just not sure if this change is that relevant.

@edolstra edolstra merged commit 5091324 into NixOS:staging Apr 6, 2020
Staging automation moved this from Needs review to Done Apr 6, 2020
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Jun 3, 2020
linux config: Set TCP_CONG_CUBIC=yes to restore the default

(cherry picked from commit 5091324)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Staging
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants