summary refs log tree commit diff
path: root/doc/guix.texi
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2020-07-22 21:07:31 +0300
committerEfraim Flashner <efraim@flashner.co.il>2020-08-02 15:54:37 +0300
commit587e0d911dfff81647015e89847084b606e68f71 (patch)
tree63cd6575ccc64c18205f589f34badade4b804e8d /doc/guix.texi
parenta05edef2ac692be8bf3033fe008b7c1b29f83123 (diff)
downloadguix-587e0d911dfff81647015e89847084b606e68f71.tar.gz
services: Add zram-device-service.
* gnu/services/linux.scm (<zram-device-configuration>): New record.
(zram-device-service-type): New variable.
* doc/guix.texi (Linux Services): Document it.
* tests/services/linux.scm (zram-swap-device-test): New tests.
Diffstat (limited to 'doc/guix.texi')
-rw-r--r--doc/guix.texi45
1 files changed, 45 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index c23ed8d715..f9cb7f204b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -27283,6 +27283,51 @@ parameters, can be done as follow:
 @end lisp
 @end deffn
 
+@cindex zram
+@cindex compressed swap
+@cindex Compressed RAM-based block devices
+@subsubheading Zram Device Service
+
+The Zram device service provides a compressed swap device in system
+memory.  The Linux Kernel documentation has more information about
+@uref{https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html,zram}
+devices.
+
+@deffn {Scheme Variable} zram-device-service-type
+This service creates the zram block device, formats it as swap and
+enables it as a swap device.  The service's value is a
+@code{zram-device-configuration} record.
+
+@deftp {Data Type} zram-device-configuration
+This is the data type representing the configuration for the zram-device
+service.
+
+@table @asis
+@item @code{size} (default @var{"1G"})
+This is the amount of space you wish to provide for the zram device.  It
+accepts a string and can be a number of bytes or use a suffix, eg.:
+@var{"512M"} or @var{1024000}.
+@item @code{compression-algorithm} (default @var{'lzo})
+This is the compression algorithm you wish to use.  It is difficult to
+list all the possible compression options, but common ones supported by
+Guix's Linux Libre Kernel include @var{'lzo}, @var{'lz4} and @var{'zstd}.
+@item @code{memory-limit} (default @var{0})
+This is the maximum amount of memory which the zram device can use.
+Setting it to '0' disables the limit.  While it is generally expected
+that compression will be 2:1, it is possible that uncompressable data
+can be written to swap and this is a method to limit how much memory can
+be used.  It accepts a string and can be a number of bytes or use a
+suffix, eg.: @var{"2G"}.
+@item @code{priority} (default @var{-1})
+This is the priority of the swap device created from the zram device.
+@code{swapon} accepts values between -1 and 32767, with higher values
+indicating higher priority.  Higher priority swap will generally be used
+first.
+@end table
+
+@end deftp
+@end deffn
+
 @node Hurd Services
 @subsection Hurd Services