# This file is part of the zram-generator project
# https://github.com/systemd/zram-generator

# At the top level, a set!variable = program
# directive executes /bin/sh -c program,
# parses the output as an expression, and remembers it in variable,
# usable in later set! and zram-size/zram-resident-limit.
set!maxhotplug = xenstore-read /local/domain/$(xenstore-read domid)/memory/hotplug-max

[zram0]
# This section describes the settings for /dev/zram0.
#
# The maximum amount of memory (in MiB). If the machine has more RAM
# than this, zram device will not be created.
#
# "host-memory-limit = none" may be used to disable this limit. This
# is also the default.
host-memory-limit = 9048

# The size of the zram device, as a function of MemTotal, both in MB.
# For example, if the machine has 1 GiB, and zram-size=ram/4,
# then the zram device will have 256 MiB.
# Fractions in the range 0.1–0.5 are recommended.
#
# The default is "min(ram / 2, 4096)".
zram-size = min(ram / 10, 2048)

# The maximum memory resident for this zram device, as a function of MemTotal,
# both in MB.
# For example, if the machine has 1 GiB, and zram-resident-limit=ram/8,
# then this device will not consume more than 128 MiB.
#
# 0 means no limit; this is the default.
zram-resident-limit = maxhotplug * 3/4

# The compression algorithm to use for the zram device,
# or leave unspecified to keep the kernel default.
#
# Subsequent algorithms are used for recompression.
# Comma-separated parameters may be specified in parentheses.
#
# Parameters without a compression algorithm are set as
# global recompression parameters.
compression-algorithm = lzo-rle zstd(level=3) (type=idle)

# By default, file systems and swap areas are trimmed on-the-go
# by setting "discard".
# Setting this to the empty string clears the option.
options =

# Write incompressible pages to this device,
# as there's no gain from keeping them in RAM
writeback-device = /dev/zvol/tarta-zoot/swap-writeback

# The following options are deprecated, and override zram-size.
# These values would be equivalent to the zram-size setting above.
#zram-fraction = 0.10
#max-zram-size = 2048


[zram1]
# This section describes the settings for /dev/zram1.
#
# host-memory-limit is not specified, so this device will always be created.

# Size the device to a tenth of RAM.
zram-size = ram / 10

# The file system to put on the device. If not specified, ext2 will be used.
fs-type = ext2

# Where to mount the file system. If a mount point is not specified,
# the device will be initialized, but will not be used for anything.
mount-point = /run/compressed-mount-point