mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
Merge pull request #114464 from rnhmjoj/ksm
nixos/ksm: rewrite using systemd-tmpfiles
This commit is contained in:
commit
d52d0a1d73
@ -26,13 +26,13 @@ in {
|
||||
systemd.services.enable-ksm = {
|
||||
description = "Enable Kernel Same-Page Merging";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "systemd-udev-settle.service" ];
|
||||
script = ''
|
||||
if [ -e /sys/kernel/mm/ksm ]; then
|
||||
script =
|
||||
''
|
||||
echo 1 > /sys/kernel/mm/ksm/run
|
||||
${optionalString (cfg.sleep != null) ''echo ${toString cfg.sleep} > /sys/kernel/mm/ksm/sleep_millisecs''}
|
||||
fi
|
||||
'';
|
||||
'' + optionalString (cfg.sleep != null)
|
||||
''
|
||||
echo ${toString cfg.sleep} > /sys/kernel/mm/ksm/sleep_millisecs
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -196,6 +196,7 @@ in
|
||||
keymap = handleTest ./keymap.nix {};
|
||||
knot = handleTest ./knot.nix {};
|
||||
krb5 = discoverTests (import ./krb5 {});
|
||||
ksm = handleTest ./ksm.nix {};
|
||||
kubernetes.dns = handleTestOn ["x86_64-linux"] ./kubernetes/dns.nix {};
|
||||
# kubernetes.e2e should eventually replace kubernetes.rbac when it works
|
||||
#kubernetes.e2e = handleTestOn ["x86_64-linux"] ./kubernetes/e2e.nix {};
|
||||
|
22
nixos/tests/ksm.nix
Normal file
22
nixos/tests/ksm.nix
Normal file
@ -0,0 +1,22 @@
|
||||
import ./make-test-python.nix ({ lib, ...} :
|
||||
|
||||
{
|
||||
name = "ksm";
|
||||
meta = with lib.maintainers; {
|
||||
maintainers = [ rnhmjoj ];
|
||||
};
|
||||
|
||||
machine = { ... }: {
|
||||
imports = [ ../modules/profiles/minimal.nix ];
|
||||
|
||||
hardware.ksm.enable = true;
|
||||
hardware.ksm.sleep = 300;
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
machine.start()
|
||||
machine.wait_until_succeeds("test $(</sys/kernel/mm/ksm/run) -eq 1")
|
||||
machine.wait_until_succeeds("test $(</sys/kernel/mm/ksm/sleep_millisecs) -eq 300")
|
||||
'';
|
||||
})
|
Loading…
Reference in New Issue
Block a user