Gentoo Archives: gentoo-user

From: Kai Krakow <hurikhan77@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Puzzled by zswap [Was: tmp on tmpfs]
Date: Fri, 26 May 2017 06:00:53
Message-Id: 20170526080031.0298508f@jupiter.sol.kaishome.de
In Reply to: [gentoo-user] Puzzled by zswap [Was: tmp on tmpfs] by Ian Zimmerman
1 Am Thu, 25 May 2017 11:46:45 -0700
2 schrieb Ian Zimmerman <itz@×××××××.net>:
3
4 > On 2017-05-24 19:05, Kai Krakow wrote:
5 >
6 > > To get in line with Rich Freeman: I didn't want to imply that zswap
7 > > only works with swap, neither that tmpfs only works with swap. Both
8 > > work without. But if you want to put some serious amount of data
9 > > into tmpfs, you need swap as a backing device sooner or later.
10 >
11 > Looking at zswap, I have several questions
12 > (even after reading linux/Documentation/vm/zswap.txt).
13 >
14 > 1. How does it know which swap device to use as backing store, if
15 > any? Clearly at boot time no swap configuration exists, even if
16 > initrd/initramfs is used, which here it is not. So when the kernel
17 > sees zswap.enable=1 in the command line, what happens?
18
19 You simply don't assign a swap device to zswap. It's transparently
20 inserted into the swapping chain of the kernel. Thus pages are first
21 compressed, and later swapped out by normal kernel processing.
22
23 > 2. The doc says it can be turned on at runtime by means of
24 > /sys/module/zswap/parameters/enabled. But kconfig doesn't make it
25 > possible to build the support as a module, only built-in, and so it is
26 > not surprising that this path doesn't exist.
27
28 I wonder why this doesn't exist. All my builtin modules have their
29 parameters in /sys/module:
30
31 # lsmod | fgrep zswap | wc -l
32 0
33 # ls -ald /sys/module/zswap
34 drwxr-xr-x 3 root root 0 26. Mai 07:54 /sys/module/zswap
35
36 > 3. It seems to require zbud to also be turned on, but this is not
37 > enforced by kconfig. Is this a bug or what?
38
39 No idea, I enabled it...
40
41 > 4. Quoting:
42 >
43 > Zswap seeks to be simple in its policies. Sysfs attributes allow
44 > for one user controlled policy:
45 > * max_pool_percent - The maximum percentage of memory that the
46 > compressed pool can occupy.
47 >
48 > Does this mean this is another (hypothetical) node in
49 > /sys/module/zswap/parameters/ ?
50
51 grep ^ /sys/module/zswap/parameters/*
52 /sys/module/zswap/parameters/compressor:lzo
53 /sys/module/zswap/parameters/enabled:Y
54 /sys/module/zswap/parameters/max_pool_percent:20
55 /sys/module/zswap/parameters/zpool:zbud
56
57 This also implies that zbud it required for zswap to even operate. If
58 you didn't include it, it may be the reason why zswap is missing
59 in /sys/module.
60
61
62 --
63 Regards,
64 Kai
65
66 Replies to list-only preferred.