-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixos/sysctl: dynamic inotify watches or higher defaults #126777
Conversation
f40a877
to
cbe2715
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find, change looks sensible to me.
c366d5e
to
654173b
Compare
ping: this is supposed to be ready 🤷 |
654173b
to
de892e5
Compare
c2dcc7b
to
8c967c1
Compare
@GrahamcOfBorg test bittorrent |
8c967c1
to
0e8af3e
Compare
@alyssais Can we merge this? All feedback seems to be duly attended. |
This change LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's great.
Small nit would be making it a let
variable or a re-usable variable for INT_MAX.
(Probably re-used elsewhere)
# https://github.com/torvalds/linux/commit/ac7b79fd190b02e7151bc7d2b9da692f537657f3 | ||
boot.kernel.sysctl."fs.inotify.max_user_instances" = | ||
if (config.boot.kernelPackages.kernel.kernelAtLeast "5.12") | ||
then mkDefault 2147483647 # INT_MAX, dynamically limited based on available memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make boot.kernel.INT_MAX
a variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, it would be more like in the stdenv
, though or lib
or even builtin
. I can make a quick follow-up PR once this is merged.
I don‘t understand the I guess it makes sense for For It might be just right, but it looks like different cases. So describing them both with "Dynamic since X" confuses me. Can you maybe elaborate that? |
The upstream commit formulation is so intricate that I don't dare to give an approximate interpretation here inline. It reads:
... and including 5.12. |
Okay, do you know what harm it would do do raise that limit unconditionally? And related: Back porting a new default is one thing, but are we sure it’s a good idea to override an existing default for current and future kernels? Edit: For reference I routinely increase |
Thanks for the continued discussion!
I don't for sure, but I assume that it's an int value, so it cannot receive more than MAX_INT.
This was inspired by how it was argued in the related issue: #36214, seems to be a requirement for docker or rather: in general name-spacing. I innocently assume because of those namespaces actually count towards this maximum. Since this is a maximum boundary and implemented as a default, it is in any case as close to a pareto-improvement as we can get (doesn't do harm to anybody, but good to many). The maximum is only hit, if you actually use it. |
That’s not what I meant. I was wondering why we only do the override from 5.12 and newer. But since then I think I understood it. I suggest adding a comment of the form:
Well the resulting harm would be if the user creates a resource exhaustion they don‘t want. So this wouldn‘t be a "pareto-improvement". The kernel has these limits for a reason. But if my phrasing above is correct, it’s fine to raise it. |
0e8af3e
to
24f2ff6
Compare
nixos/modules/config/sysctl.nix
Outdated
# Dynamic since kernel v5.12 | ||
# https://github.com/torvalds/linux/commit/ac7b79fd190b02e7151bc7d2b9da692f537657f3 | ||
# From version 5.12 inotify watches count against a RAM resource limit, so kernel | ||
# mainatainers (see commit) suggest to increase this limit to the maximum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# mainatainers (see commit) suggest to increase this limit to the maximum | |
# maintainers (see commit) suggest to increase this limit to the maximum |
Nowadays most applications require a good amount of inotify watches, so raise our default to what other distros do. If kernel supports it enable dynamic setting. fixes NixOS#36214, NixOS#65001 (re-fix) - NixOS/nixops#890 - divnix/digga#209 replaces: NixOS#112472
24f2ff6
to
7336ba3
Compare
I think I am 100% in favor of the I am a little bit uncertain about the |
Cleaning up my follow-up list. Please anyone feel free to pick this up. |
Nowadays most applications require a good amount of inotify watches,
so raise our default to what other distros do. If kernel supports it
enable dynamic setting.