

Linux Swap Table Code Shows The Potential For Huge Performance Gains (phoronix.com) 23
A new set of 27 Linux kernel patches introduces a "Swap Tables" mechanism aimed at enhancing virtual memory management. As Phoronix's Michael Larabel reports, "the hope is for lower memory use, higher performance, dynamic swap allocation and growth, greater extensibility, and other improvements over the existing swap code within the Linux kernel." From the report: Engineer Kairui Song with Tencent posted the Swap Table patch series today for implementing the design ideas discussed in recent months by kernel developers. The results are very exciting so let's get straight to it: "With this series, swap subsystem will have a ~20-30% performance gain from basic sequential swap to heavy workloads, for both 4K and mTHP folios. The idle memory usage is already much lower, the average memory consumption is still the same or will also be even lower (with further works). And this enables many more future optimizations, with better defined swap operations." "The patches also clean-up and address various historical issues with the SWAP subsystem," notes Larabel.
Context: In Linux, swap space acts as an overflow for RAM, storing inactive memory pages on disk to free up RAM for active processes. Traditional swap mechanisms are limited in flexibility and performance. The proposed "Swap Tables" aim to address these issues by allowing more efficient and dynamic management of swap space, potentially leading to better system responsiveness and resource utilization.
Context: In Linux, swap space acts as an overflow for RAM, storing inactive memory pages on disk to free up RAM for active processes. Traditional swap mechanisms are limited in flexibility and performance. The proposed "Swap Tables" aim to address these issues by allowing more efficient and dynamic management of swap space, potentially leading to better system responsiveness and resource utilization.
Huge Performance Gains... (Score:3)
For those unfortunate / foolish enough to be relying on swap...
Re: (Score:2)
This was going to be my response as well. I can't remember the last time I ran a linux instance with insufficient memory. But I can see use cases on SOC or IoT devices.
Re: (Score:3)
Re: (Score:2)
I've seen this on the fine print with the marketing of low-end Android tablets on Amazon and ebay.
6GB of RAM - i.e. 4+2. but does anyone really want the wear and tear of writing to storage on media that is soldered in? Admittedly this is throwaway hardware that will end up in landfill/recycling within 4 years but still...
Linux uses Swap even when memory isn't full (Score:4, Informative)
Re:Linux uses Swap even when memory isn't full (Score:4, Informative)
It's almost never a good idea to leave this value at it's default. For example - the "tuned" profile "throughput-performance" will set this down to 5.
Re: (Score:2)
I always disable swap, unless I am on some pathetically limited hardware. I have 64GB RAM in my desktop and 8GB in my laptop, and no need for any swap on either. Swap just means the system thrashes more before the OOM killer kicks in, plus I don't need a bunch of extra writes on my SSDs.
Re: (Score:2)
I always disable swap, unless I am on some pathetically limited hardware. I have 64GB RAM in my desktop and 8GB in my laptop, and no need for any swap on either. Swap just means the system thrashes more before the OOM killer kicks in, plus I don't need a bunch of extra writes on my SSDs.
My desktop also has 64GB of RAM but it does swap occasionally.
Re: Linux uses Swap even when memory isn't full (Score:2)
It's almost never a good idea to leave this value at it's default. For example - the "tuned" profile "throughput-performance" will set this down to 5.
Yah that still swaps. Linux will fill all physical memory with filesystem cache first. Then does one of two things for each cache miss. At a swappiness of 5, for every 100 pages read, 97 pages of old FS cache will be replaced and 3 of some process's idle memory will get swapped out. All you're doing is slowing it down, and over time you'll always have a bunch of process memory swapped out. The actual rate it happens at depends on your workload, how many cache misses you get over time. A daily filesystem bac
Why (Score:2)
Why do we need virtual memory these days?
Re: (Score:3, Informative)
Re: (Score:2)
If your memory is so tight that you need all this shuffling, maybe you should invest another $25 for more RAM!
Re: (Score:2)
Virtual Memory does not require swapping ability to still be VM. Swapping is an optional add-on feature.
Re: (Score:2)
BTW: Swap space is still a physical memory type, just like DRAM, but much slower access.
Re: (Score:3)
I understand the usage of the term "virtual memory" here, as its been incorrectly correlated to swapping memory to disk since its inception really... but i do hope at some point the realization in the broader community that "virtual memory" literally means all memory on a modern operating system's user space. this is how we can get multiple instances of the same application running at once, as they're using the same virtual memory addresses that are then translated over to physical addresses by the memory c
English is an overloaded language Re:Why (Score:1)
We use the same words or phrases for different things. Sometimes this leads to confusion.
Re: (Score:2)
This is not one of those cases. Virtual memory is not swap. Anyone that conflates the two has just got it wrong.
Re: (Score:2)
You might find it helpful to read the summary.
Context: In Linux, swap space acts as an overflow for RAM, storing inactive memory pages on disk to free up RAM for active processes
This is indeed talking about swapping memory pages to disk.
Re: (Score:2)
According to the summary:
Context: In Linux, swap space acts as an overflow for RAM, storing inactive memory pages on disk to free up RAM for active processes
This is clearly referring to swapping memory to disk, not your proposed concept of "all memory on a modern OS user space."
Re: (Score:2)
Well, for one specific case; I needed to start up four VMs in my home lab for a test where each one needed 16GB of RAM, my system had 64GB total, and I didn't feel like going and buying several hundred dollars of RAM, throwing away the 64GB I have already in order to do it.
Re: Why (Score:2)
That is a different use case where you wanna use KMS memory merging itâ(TM)s built into the kernel.
Re: (Score:2)
There's also the sheer convenience(and potentially better outcomes, dependi