this post was submitted on 13 Oct 2023
31 points (100.0% liked)

Linux

47369 readers
897 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

In case you don't know Multi-Gen LRU is an alternative LRU implementation that optimizes page reclaim and improves performance under memory pressure. Page reclaim decides the kernel's caching policy and ability to overcommit memory. It directly impacts the kswapd CPU usage and RAM efficiency.

Has anyone enabled this feature on their machines? Have you noticed any performance gains or memory management improvements? It's developed by Google and is reportedly is being used in ChromeOS and Android.

all 13 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 11 months ago* (last edited 11 months ago) (1 children)

I use this on all of my machines now, it does a much better job of preventing swap thrashing than the original LRU code. I've been running the MGLRU patch set for like two years (?) without any downside that I've been able to detect.

Edit: We switched to using the MGLRU patch set for all of our Arch kernel packages in the asus-linux community back when the patch set was in development, there have been zero problem reports over an installed base of at least a couple hundred people. As far as I can tell there really isn't a downside to using it.

[–] [email protected] 2 points 11 months ago (1 children)

How do I enable it? I've been having huge issues with reclaiming swap and memory usage in general. Do I have to compile the kernel myself and if I do, where is the option located?

[–] [email protected] 2 points 11 months ago (1 children)

Check your running kernel's config at /proc/config (or config.gz) to see if it's enabled.

https://docs.kernel.org/admin-guide/mm/multigen_lru.html has admin/usage details.

If your current kernel doesn't build multi-gen LRU then you'll need to build a kernel package that does, or switch to one that enables it.

[–] [email protected] 1 points 11 months ago (1 children)

Ah, then where in the menuconfig is this option located, if I need to build my own kernel...

[–] [email protected] 1 points 11 months ago* (last edited 11 months ago) (1 children)

Use the search function and look for LRU_GEN. Try make nconfig while you're at it, it's the new terminal config menu system.

[–] [email protected] 1 points 10 months ago

man, make nconfig is such a life savior when configuring a new kernel, it's great

[–] [email protected] 1 points 11 months ago (5 children)

I don’t even use swap anymore. 32gb of ram ought to be enough.

[–] [email protected] 6 points 11 months ago (1 children)

I know the feeling. I have a “desktop” that has 640GB of memory. Now I say “desktop” because while it IS desktop I mainly use it for a nested virtualization lab.

Of course creating a 500gb RAM disk for some ungodly fast file manipulation is not something I’ve ever thought about or done. /s.

In case you’re wondering it’s an Intel MacPro that just happened to be compatible with the memory in a retired production blade … so yay!

[–] [email protected] 2 points 11 months ago

I jammed 64GB into my work laptop sort of by accident (I thought the original kit I ordered was 2x16GB but it was 1x32 so why not keep going) and I have no regrets. 20GB tmpfs for builds? Why not?

[–] [email protected] 5 points 11 months ago* (last edited 11 months ago)

I still keep some swap around on the off chance something eats up a shit ton of memory. Dealing with the OOM killer is always a bad time.

If you don't want to use disk swap there's always zram, it'll consume like ~4GB RAM for ~12GB active swap if you use zstd with it. It won't allocate any (meaningful amount of) compressed memory if swap isn't active so there's not much of a downside here.

[–] [email protected] 2 points 11 months ago

Wait until 32GB RAM isn't enough and the OOM decides to randomly kill processes. Especially with memory leaks...

[–] [email protected] 1 points 11 months ago

I especially love disabling swap on windows, sometimes it gets weird