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
modules/nix-daemon: Replace daemon(IO)NiceLevel options #138741
modules/nix-daemon: Replace daemon(IO)NiceLevel options #138741
Conversation
Why not remove the option altogether and let users set |
Discovery and documentation. An entry in the manual for this would be useful too. |
Perhaps add a sentence like this to the options: While a lower priority can improve system responsiveness during updates, it comes at the risk of slowing down or potentially starving crucial configuration updates, limiting your ability to fix problems during load. |
See also NixOS/nix#5235 |
I’ll add a note to the description. I also wonder whether it would make sense to not expose the real‐time scheduling variants. I can’t think of a use case where having the nix-daemon and its children always pre‐empt every other thread on a system has any benefit. For the CPU scheduling policy, the most useful variants in my opinion are |
yeah just remove the realtime ones. |
e3edb4f
to
97f5c84
Compare
I removed the real‐time scheduling policies and classes as well as the I also wonder if |
Relevant section of man 7 sched:
I can confirm |
As far as I can tell, systemd just uses The cgroup code does not appear to do anything with it and there is no code writing to any |
If I understand https://unix.stackexchange.com/questions/340283/using-and-understanding-systemd-scheduling-related-options-in-a-desktop-context/515893#515893 correctly, the An alternative to completely removing the |
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.
As a breaking change (option renaming), it would need to be documented inside the corresponding release note.
97f5c84
to
9e7fc40
Compare
I added an explanation to the release notes. Is this adequate? |
fa612c4
to
7c205ca
Compare
As this PR is merging to the master branch, the corresponding breaking changes should appear in It seems that the release note should be short, inform the user "what to do", and provide the links to detailed documentation. You can link to the documentation of the options like [`nix.daemonCPUSchedPolicy`](options.html#opt-nix.daemonCPUSchedPolicy) |
7c205ca
to
6828154
Compare
Thank you. I moved it to |
6828154
to
b94527d
Compare
It seems that the lines are put under the |
b94527d
to
d650ee3
Compare
Sorry about that. Moved it to the correct place. |
d650ee3
to
3e74579
Compare
The nix.daemonNiceLevel options allows for setting the nice level of the Nix daemon process. On a modern Linux kernel with group scheduling the nice level only affects threads relative to other threads in the same task group (see sched(7)). Therefore this option has not the effect one might expect. The options daemonCPUSchedPolicy and daemonIOSchedClass are introduced and the daemonIONiceLevel option renamed to daemonIOSchedPrority for consistency. These options allow for more effective control over CPU and I/O scheduling. Instead of setting daemonNiceLevel to a high value to increase the responsiveness of an interactive system during builds -- which would not have the desired effect, as described above -- one could set both daemonCPUSchedPolicy and daemonIOSchedClass to idle.
3e74579
to
d251eed
Compare
I considered proposing To test this hypothesis, I built These results may have however been confounded by a few factors specific to my machine. Apart from the large CPU cache and relatively fast RAM, I use a kernel with a custom hardening config, run builds in a tmpfs and most of the CPU cores are designated as full dynticks CPUs. |
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.
This is missing mkRenamedOptionModule
for renamed options.
Or mkRemovedOptionModule
if the options are not equivalent I guess.
It was a bit unclear what values I should use if I want maximum interactive session responsiveness while not starving the build resources. Recommendations would have been nice. |
I can create another PR for that. |
From my personal experience |
#147497 suggests |
See #147490. |
This option doesn't really work the way it should anyway [1]. This reverts commit cbf6ea9. [1]: NixOS/nixpkgs#138741
Was removed in NixOS/nixpkgs#138741
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/upgrade-on-rasberry-pi-make-it-unresponsive/17345/2 |
This option doesn't really work the way it should anyway [1]. This reverts commit cbf6ea9. [1]: NixOS/nixpkgs#138741
The
nix.daemonNiceLevel
options allows for setting the nice level of theNix daemon process. On a modern Linux kernel with group scheduling the
nice level only affects threads relative to other threads in the same
task group (see
sched(7)
). Therefore this option has not the effect onemight expect.
The options
daemonCPUSchedPolicy
,daemonCPUSchedPriority
,daemonIOSchedClass
are introduced and thedaemonIONiceLevel
optionrenamed to
daemonIOSchedPrority
for consistency. These options allow formore effective control over CPU and I/O scheduling.
Instead of setting
daemonNiceLevel
to a high value to increase theresponsiveness of an interactive system during builds -- which would not
have the desired effect, as described above -- one could set both
daemonCPUSchedPolicy
anddaemonIOSchedClass
to idle.Motivation for this change
Heavy build jobs can affect other tasks on a system and reduce responsiveness during interactive use.
The
daemonNiceLevel
option is not particularly useful to mitigate this problem on recent Linux kernels, because with group scheduling the nice level of a thread only affects scheduling relative to other threads in the same task group.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)