Fedora 34 Change: Scale ZRAM to Full Memory Size (Self-Contained Change proposal)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://fedoraproject.org/wiki/Changes/Scale_ZRAM_to_full_memory_size


== Summary ==
Fedora 33 [[Changes/SwapOnZRAM|enabled zram by default]]. The size of
the virtual swap devices was set so that the amount of memory used for
compressed swap pages was limited to a quarter of physical memory in
typical scenarios. That size is now increased to half of physical
memory (`zram-fraction` becomes 1.0, `max-zram-size` becomes 8 GiB).
This allows systems with small amounts to successfully launch the
[https://anaconda-installer.readthedocs.io/en/latest/ Anaconda
installer] and other programs.

== Owner ==

* Name: [[User:Zbyszek|Zbigniew Jędrzejewski-Szmek]]
* Email: zbyszek@xxxxxxxxx
* Name: [[User:jwrdegoede|Hans de Goede]]
* Email: hdegoede@xxxxxxxxxx


== Detailed Description ==

When ZRAM was enabled by default in Fedora 33, the size of the device
(before compression) was limited to fraction 0.5 of RAM or 4 GiB,
whichever is less. The reason to limit the fraction to less than 1.0
is that with only incompressible data in memory, whole RAM would be
filled by the "compressed" pages, leaving no RAM for normal use. But
this concern seems to have been overblown, and there have been no
reports of compressed swap taking up too much memory. In real use, we
will have at least a few hundred MiB of code in memory, which
compresses quite well, so some compression will occur even when
working with incompressible data. In typical usage scenarios, we get
effective compression of 2:1 or 3:1, which means that the compressed
pages use at most between 1/4th and 1/6th of RAM. By increasing the
fraction to 1.0, we expect to consign up to half of RAM for compressed
pages.

Increasing the size of the device is important for small devices. For
devices with 1GB of RAM, sizing ZRAM to 1 GiB allows successful
installation with Anaconda. In general, it is expected that having
more compressed swap will make the device more functional after
installation too. This increase is the most important for devices with
small amounts of memory (< 1 GiB), but will be beneficial to systems
with slightly larger systems (1–8 GiB).

Technically, this change is completely trivial, amounting to two lines
of configuration. Nevertheless, there is some potential for problems
with incompressible workloads. The experience with ZRAM so far makes
the Change authors optimistic that no issues will be encountered, but
users and other developers should be aware of the change.


== Benefit to Fedora ==

Fedora works better on devices with low RAM. In particular, the
installer can function.

== Scope ==
* Proposal owners: change the defaults in `zram-generator-defaults`
package to `zram-fraction=1.0`, `max-zram-size=8096`.

* Other developers: N/A (not a System Wide Change)
* Policies and guidelines: N/A (not a System Wide Change)
* Trademark approval: N/A (not needed for this Change)


== Upgrade/compatibility impact ==
Default configuration is changed. Systems with local configuration
will not be affected. Systems which had zram-generator disabled will
not be affected.

== How To Test ==
Install the new version of the `zram-generator-defaults` package,
execute `sudo systemctl daemon-reload && sudo systemctl restart
swap-create@zram0`, use `zramctl` to check that the device has the
expected size. After some use, check that pages are compressed at
least with ration 2:1:
<pre>
$ zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lzo-rle       7.6G   4K   74B   12K       4 [SWAP]
                         ^       ^    ^
                         |        \____\_______ the ratio of those
values should be more than 2:1
                         |
                         `------ this should be approx the size of RAM
</pre>
(Note that the device is destroyed and recreated during restart. This
means that all pages will be "swapped in", i.e. decompressed. On
machines with low memory, rebooting might be a better option.)

== User Experience ==
Not user visible.

== Dependencies ==
None.

== Contingency Plan ==
* Contingency mechanism: Revert default configuration to previous values.
* Contingency deadline: Final freeze, any time really.
* Blocks release? No
* Blocks product? No

== Documentation ==
None.

== Release Notes ==
The default size of compressed zram devices (`/dev/zram0`) has been
increased to 1.0 fraction of RAM, or 8 GiB, whichever is smaller.


-- 
Ben Cotton
He / Him / His
Senior Program Manager, Fedora & CentOS Stream
Red Hat
TZ=America/Indiana/Indianapolis
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux