re-enable zramSwap on all devices

this is critical on moby, though even with this swap, we run out of CMA (videoram) instead -- just later
This commit is contained in:
2023-07-13 23:37:30 +00:00
parent e5072c8837
commit 962ffeab7e
2 changed files with 22 additions and 5 deletions

View File

@@ -59,11 +59,6 @@
} }
]; ];
# in-memory compressed RAM (seems to be dynamically sized)
# zramSwap = {
# enable = true;
# };
# btrfs doesn't easily support swapfiles # btrfs doesn't easily support swapfiles
# swapDevices = [ # swapDevices = [
# { device = "/nix/persist/swapfile"; size = 4096; } # { device = "/nix/persist/swapfile"; size = 4096; }

View File

@@ -60,6 +60,28 @@ in
# some services which use private directories error if the parent (/var/lib/private) isn't 700. # 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"; 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: <https://www.kernel.org/doc/Documentation/blockdev/zram.txt>
#
# 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" = { # fileSystems."/mnt/servo-nfs" = {
# device = "servo-hn:/"; # device = "servo-hn:/";
# noCheck = true; # noCheck = true;