#56 Consider turning on zram
Closed: Deferred to upstream 2 years ago by chrismurphy. Opened 4 years ago by mclasen.

Supposedly, it does a great job on low-memory systems.


zram.service is enabled by default on netinstalls since at least Fedora 28. It's not enabled on lives, and I don't understand why. Depending on oom killer in a live environment is a very bad experience [1] and totally rectified with zram.service running (I've not tested systems with less than 1500M RAM).

Since it's been enabled on netinstall with no complaints so far, and zram.service is available on live media, and the single change is to make the service enabled by default, I think it's low risk to enable it as soon as Fedora 29 lives. It's also just as easy to revert.

For production use, I've been using zswap for almost a year.[3] I can vouch for it moderating the steep performance loss when swap starts being used, which is the entire point of either zram or zswap. I'd guess that zram is better suited for cases where not more than 1.5x RAM is needed, whereas zswap is only limited by the backing swap partition (or file) size. Both can be configured to use lz4, so compression ratios are the same.

[1] bugs related to lives running out of memory in low RAM VM's

anaconda invoked oom-killer
https://bugzilla.redhat.com/show_bug.cgi?id=1560146

using search to launch Terminal causes uncommanded launch of multiple apps, invokes OOM, implodes the whole environment
https://bugzilla.redhat.com/show_bug.cgi?id=1558803

zram.service is not enabled on LiveOS
https://bugzilla.redhat.com/show_bug.cgi?id=1562278

[2]
https://github.com/rhinstaller/anaconda/blob/master/scripts/zramswapon

[3] zswap is tacked onto an existing swap partition (or swapfile) with the following boot parameters
zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4

On my F28 system, I see:

$ systemctl status zram
‚óŹ zram.service - Service enabling compressing RAM with zRam
   Loaded: loaded (/usr/lib/systemd/system/zram.service; static; vendor preset: disabled)
   Active: inactive (dead)

I have no clue why it would be enabled for netinstalls. Clearly we need to change the vendor preset if we want to enable it.

Metadata Update from @catanzaro:
- Issue tagged with: meeting

3 years ago

Vendor preset is enabled on netinstall, and disabled on live, maybe to prevent it from being enabled by default post-install. I'm not really sure about the history. It seems intended by the installer team that it be enabled for up to 2G RAM systems.
https://github.com/rhinstaller/anaconda/commit/f9ecf9c43a3fea16c69701dd5f35c975311e8283#diff-2249186ca2d9e5b5d622b2de08adbbd3

Based on
https://www.kernel.org/doc/Documentation/blockdev/zram.txt
it would use 16MB of memory overhead for a system with 16GB RAM, if a 16GB zram device is created, which doesn't sound bad. But I've only tested zswap in production.

decision from the Dec 17 wg meeting: lets turn zram on for live media. Turning it on for installed systems may need more research

Metadata Update from @catanzaro:
- Issue untagged with: meeting

3 years ago

I think nobody has an action item for this. Who wants to make it happen?

Metadata Update from @chrismurphy:
- Issue assigned to chrismurphy
- Issue tagged with: meeting

2 years ago

We didn't have a quorum at this week's meeting, but Chris agreed to take the action item to follow up with Anaconda developers about implementing our previously-agreed decision to enable zram on live media.

Metadata Update from @catanzaro:
- Issue untagged with: meeting

2 years ago

This PR has been approved.
https://github.com/rhinstaller/anaconda/pull/2039

Once that lands in Rawhide and sanity tests OK, I'll make a PR for the following change to fedora-live-base.ks to remove startup of legacy swap. I've given anaconda folks a heads up.
https://pagure.io/fork/chrismurphy/fedora-kickstarts/c/370d389a3f172ac543a9e03e71160dc395c09786?branch=devel

This is in Rawhide and tests out OK.
https://github.com/rhinstaller/anaconda/pull/2039#issuecomment-511613612

And loosely related is cleaning up the legacy swap stuff
https://pagure.io/fedora-kickstarts/pull-request/544

This is sufficiently complete to close out this issue.

Metadata Update from @chrismurphy:
- Issue close_status updated to: Deferred to upstream
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata