about summary refs log tree commit diff
path: root/modules/system/ksm.nix
blob: b54cedc91148378fdda7c1c418469ec661d883c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{ config, lib, ... }:

with lib;

{
  options.vuizvui.system.enableKSM = mkEnableOption "Kernel Same-Page Merging";

  config = mkIf config.vuizvui.system.enableKSM {
    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
          echo 1 > /sys/kernel/mm/ksm/run
        fi
      '';
    };
  };
}