On 6/5/20 7:33 PM, Chris Murphy wrote:
On Fri, Jun 5, 2020 at 8:12 PM Samuel Sieb <samuel(a)sieb.net>
wrote:
All three of those listed provide competing configurations for swap on
zram. Just to make a fine point, zram is generic, it is not swap
specific. It's just a compressed ram disk. Zswap is a different thing,
it is swap specific, providing a memory based writeback cache to a
disk based swap.
Ok, that makes sense about zram. It's a lot simpler than I was thinking
it was.
The generator does require a reboot to change configurations. You
could absolutely say, but Chris, the other ones you can just systemctl
restart! That is true, but except for testing, I don't see that as an
advantage compared to the overall simplisticity of zram-generator and
reusing the existing infrastructure in systemd that's already well
tested and maintained.
Sure, I'll set that up for the next time I reboot. But that is likely
to still be a long time from now.
Although really any value higher than the disk based swap is
sufficient.
The systemd-swap service appears to set the priority of zram to the
maximum possible.
> No, it was quite clear that I was modifying the right config.
It's the
> /etc/systemd/swap.conf as described in the man page and it was affecting
> the result.
OK that is not for zram-generator. That's for one of the others. Off
hand I don't know which one it's for, this is way too confusing
because of all the competing implementations, which is part of the
motivation of the feature -> buh bye, thank you for your service!
Sorry, I guess that wasn't clear. That's the config file for
systemd-swap which is what I was testing.
> Part of my concern is that if it's not actually full, then
why is it
> using so much of the disk swap?
Not sure. What should be true is if you swapoff on /dev/sda3 it'll
move any referenced anon pages to /dev/zram0. And then if you swapon
/dev/sda3 it will use 0 bytes until /dev/zram0 is full. What kernel
version are you using?
That is what I did do.
kernel 5.5.17-200.fc31.x86_64
> For upstream, do you mean the kernel?
Yes.
bugzilla.kernel.org - this goes to the linux-mm folks (memory
management) but you can search for a zram bug and just see what
component they use and post the bug here and I'll pick it up.
I reset everything and now I can't reproduce it. I wonder if it was
because I had zswap enabled as well. When I was going to file the bug
report, I came across a comment that it's not beneficial to use them
both at the same time.
# swapon
NAME TYPE SIZE USED PRIO
/dev/sda3 partition 16G 0B -2
/zram0 partition 5G 4.6G 32767
# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4 5G 4.6G 1.5G 1.5G 4
It looks like it's working properly now. So it seems likely that it was
user error. And for the little it matters, I approve of the change
proposal. I will have to test it out on my other systems as well now.