|
|
Subscribe / Log in / New account

Out-of-memory victim selection with BPF

Out-of-memory victim selection with BPF

Posted Aug 21, 2023 17:22 UTC (Mon) by ibukanov (subscriber, #3942)
In reply to: Out-of-memory victim selection with BPF by rrolls
Parent article: Out-of-memory victim selection with BPF

Windows and MacOS by default use memory compression that handles out-of memory much gracefully compared with swapping to slow or even not-so-fast SSD, while with many Linux distros the compression has to be explicitly enabled. Plus Linux has not one, but two memory compressors, zram and zswap, with each having plusses and minuses with the end result one may even need to enable and carefully configure both. Plus when the compression is enabled, it is not configured with good defaults. Like not using lz4 or zstd compression algorithms, not tuning swap look ahead etc.


to post comments

Out-of-memory victim selection with BPF

Posted Aug 22, 2023 13:36 UTC (Tue) by intelfx (subscriber, #130118) [Link] (1 responses)

> Plus Linux has not one, but two memory compressors, zram and zswap, with each having plusses and minuses with the end result one may even need to enable and carefully configure both.

What are their plusses and minuses? What is the reason one might need to configure _both_?

> Plus when the compression is enabled, it is not configured with good defaults. Like not using lz4 or zstd compression algorithms, not tuning swap look ahead etc.

Could you elaborate?

Out-of-memory victim selection with BPF

Posted Aug 22, 2023 16:36 UTC (Tue) by ibukanov (subscriber, #3942) [Link]

See https://linuxreviews.org/Zram and https://www.reddit.com/r/Fedora/comments/mzun99/new_zram_... for a good overview and benchmarks.

My anecdotal experience is that when the memory usage is bursty with only occasionally exceeding the total RAM by 20-30% (like when compiling and linking many things in parallel), lz4 performs better then zstd. Otherwise zstd is abetter choice and its pity that is not used by default.

Also note that with a good modern SSD that has sustained read-write speed of 3 GB/s or more with hardware encryption on and does not suffer from persistent writing as in past it does not make sense to use compressed memory. Even with lz4 and multiple parallel compression the SSD will be faster and leave CPU available to do the real job. But if one does not trust hardware encryption, then zram with zstd or lz4 is the way to go.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds