diff --git a/hosts/by-name/servo/fs.nix b/hosts/by-name/servo/fs.nix index f41d927d1..13643af52 100644 --- a/hosts/by-name/servo/fs.nix +++ b/hosts/by-name/servo/fs.nix @@ -59,11 +59,6 @@ } ]; - # in-memory compressed RAM (seems to be dynamically sized) - # zramSwap = { - # enable = true; - # }; - # btrfs doesn't easily support swapfiles # swapDevices = [ # { device = "/nix/persist/swapfile"; size = 4096; } diff --git a/hosts/common/fs.nix b/hosts/common/fs.nix index 74d9f00e5..1ae8189b9 100644 --- a/hosts/common/fs.nix +++ b/hosts/common/fs.nix @@ -60,6 +60,28 @@ in # some services which use private directories error if the parent (/var/lib/private) isn't 700. sane.fs."/var/lib/private".dir.acl.mode = "0700"; + # in-memory compressed RAM + # defaults to compressing at most 50% size of RAM + # claimed compression ratio is about 2:1 + # - but on moby w/ zstd default i see 4-7:1 (ratio lowers as it fills) + # note that idle overhead is about 0.05% of capacity (e.g. 2B per 4kB page) + # docs: + # + # to query effectiveness: + # `cat /sys/block/zram0/mm_stat`. whitespace separated fields: + # - *orig_data_size* (bytes) + # - *compr_data_size* (bytes) + # - mem_used_total (bytes) + # - mem_limit (bytes) + # - mem_used_max (bytes) + # - *same_pages* (pages which are e.g. all zeros (consumes no additional mem)) + # - *pages_compacted* (pages which have been freed thanks to compression) + # - huge_pages (incompressible) + # + # see also: + # - `man zramctl` + zramSwap.enable = true; + # fileSystems."/mnt/servo-nfs" = { # device = "servo-hn:/"; # noCheck = true;