Am Thu, 25 May 2017 11:46:45 -0700
schrieb Ian Zimmerman :
> On 2017-05-24 19:05, Kai Krakow wrote:
>
> > To get in line with Rich Freeman: I didn't want to imply that zswap
> > only works with swap, neither that tmpfs only works with swap. Both
> > work without. But if you want to put some serious amount of data
> > into tmpfs, you need swap as a backing device sooner or later.
>
> Looking at zswap, I have several questions
> (even after reading linux/Documentation/vm/zswap.txt).
>
> 1. How does it know which swap device to use as backing store, if
> any? Clearly at boot time no swap configuration exists, even if
> initrd/initramfs is used, which here it is not. So when the kernel
> sees zswap.enable=1 in the command line, what happens?
You simply don't assign a swap device to zswap. It's transparently
inserted into the swapping chain of the kernel. Thus pages are first
compressed, and later swapped out by normal kernel processing.
> 2. The doc says it can be turned on at runtime by means of
> /sys/module/zswap/parameters/enabled. But kconfig doesn't make it
> possible to build the support as a module, only built-in, and so it is
> not surprising that this path doesn't exist.
I wonder why this doesn't exist. All my builtin modules have their
parameters in /sys/module:
# lsmod | fgrep zswap | wc -l
0
# ls -ald /sys/module/zswap
drwxr-xr-x 3 root root 0 26. Mai 07:54 /sys/module/zswap
> 3. It seems to require zbud to also be turned on, but this is not
> enforced by kconfig. Is this a bug or what?
No idea, I enabled it...
> 4. Quoting:
>
> Zswap seeks to be simple in its policies. Sysfs attributes allow
> for one user controlled policy:
> * max_pool_percent - The maximum percentage of memory that the
> compressed pool can occupy.
>
> Does this mean this is another (hypothetical) node in
> /sys/module/zswap/parameters/ ?
grep ^ /sys/module/zswap/parameters/*
/sys/module/zswap/parameters/compressor:lzo
/sys/module/zswap/parameters/enabled:Y
/sys/module/zswap/parameters/max_pool_percent:20
/sys/module/zswap/parameters/zpool:zbud
This also implies that zbud it required for zswap to even operate. If
you didn't include it, it may be the reason why zswap is missing
in /sys/module.
--
Regards,
Kai
Replies to list-only preferred.