Merge pull request #273921 from SaltyKitkat/oomd
nixos/systemd: update oomd configuration
This commit is contained in:
commit
9cab49c71b
@ -76,6 +76,17 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
|
||||
|
||||
`CONFIG_FILE_NAME` includes `bpf_pinning`, `ematch_map`, `group`, `nl_protos`, `rt_dsfield`, `rt_protos`, `rt_realms`, `rt_scopes`, and `rt_tables`.
|
||||
|
||||
- The `systemd.oomd` module behavior is changed as:
|
||||
|
||||
- Raise ManagedOOMMemoryPressureLimit from 50% to 80%. This should make systemd-oomd kill things less often, and fix issues like [this](https://pagure.io/fedora-workstation/issue/358).
|
||||
Reference: [commit](https://src.fedoraproject.org/rpms/systemd/c/806c95e1c70af18f81d499b24cd7acfa4c36ffd6?branch=806c95e1c70af18f81d499b24cd7acfa4c36ffd6)
|
||||
|
||||
- Remove swap policy. This helps prevent killing processes when user's swap is small.
|
||||
|
||||
- Expand the memory pressure policy to system.slice, user-.slice, and all user owned slices. Reference: [commit](https://src.fedoraproject.org/rpms/systemd/c/7665e1796f915dedbf8e014f0a78f4f576d609bb)
|
||||
|
||||
- `systemd.oomd.enableUserServices` is renamed to `systemd.oomd.enableUserSlices`.
|
||||
|
||||
## Other Notable Changes {#sec-release-24.05-notable-changes}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
@ -3,14 +3,18 @@
|
||||
cfg = config.systemd.oomd;
|
||||
|
||||
in {
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule [ "systemd" "oomd" "enableUserServices" ] "Use systemd.oomd.enableUserSlices instead.")
|
||||
];
|
||||
|
||||
options.systemd.oomd = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "the `systemd-oomd` OOM killer") // { default = true; };
|
||||
|
||||
# Fedora enables the first and third option by default. See the 10-oomd-* files here:
|
||||
# https://src.fedoraproject.org/rpms/systemd/tree/acb90c49c42276b06375a66c73673ac351025597
|
||||
# https://src.fedoraproject.org/rpms/systemd/tree/806c95e1c70af18f81d499b24cd7acfa4c36ffd6
|
||||
enableRootSlice = lib.mkEnableOption (lib.mdDoc "oomd on the root slice (`-.slice`)");
|
||||
enableSystemSlice = lib.mkEnableOption (lib.mdDoc "oomd on the system slice (`system.slice`)");
|
||||
enableUserServices = lib.mkEnableOption (lib.mdDoc "oomd on all user services (`user@.service`)");
|
||||
enableUserSlices = lib.mkEnableOption (lib.mdDoc "oomd on all user slices (`user@.slice`) and all user owned slices");
|
||||
|
||||
extraConfig = lib.mkOption {
|
||||
type = with lib.types; attrsOf (oneOf [ str int bool ]);
|
||||
@ -44,14 +48,23 @@ in {
|
||||
users.groups.systemd-oom = { };
|
||||
|
||||
systemd.slices."-".sliceConfig = lib.mkIf cfg.enableRootSlice {
|
||||
ManagedOOMSwap = "kill";
|
||||
ManagedOOMMemoryPressure = "kill";
|
||||
ManagedOOMMemoryPressureLimit = "80%";
|
||||
};
|
||||
systemd.slices."system".sliceConfig = lib.mkIf cfg.enableSystemSlice {
|
||||
ManagedOOMSwap = "kill";
|
||||
};
|
||||
systemd.services."user@".serviceConfig = lib.mkIf cfg.enableUserServices {
|
||||
ManagedOOMMemoryPressure = "kill";
|
||||
ManagedOOMMemoryPressureLimit = "50%";
|
||||
ManagedOOMMemoryPressureLimit = "80%";
|
||||
};
|
||||
systemd.slices."user-".sliceConfig = lib.mkIf cfg.enableUserSlices {
|
||||
ManagedOOMMemoryPressure = "kill";
|
||||
ManagedOOMMemoryPressureLimit = "80%";
|
||||
};
|
||||
systemd.user.units."slice" = lib.mkIf cfg.enableUserSlices {
|
||||
text = ''
|
||||
ManagedOOMMemoryPressure=kill
|
||||
ManagedOOMMemoryPressureLimit=80%
|
||||
'';
|
||||
overrideStrategy = "asDropin";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user