|
|
Subscribe / Log in / New account

"User-space data may not be resident in RAM"

"User-space data may not be resident in RAM"

Posted Jul 8, 2020 20:38 UTC (Wed) by epa (subscriber, #39769)
In reply to: "User-space data may not be resident in RAM" by corbet
Parent article: Sleepable BPF programs

If you apply the rule of thumb that swap space should equal twice the physical RAM(*), then you only need triple the amount of RAM to eliminate swap altogether. That could happen in a year or two depending on how well Moore's Law applies to RAM production. Of course, software becomes more bloated at the same time, which is why we still have swap space, but I think the improvement in machine size is slowly outstripping the rate at which programmers can add bloat.

As far as I know, Android systems don't have swap space. I would expect most embedded Linux systems to do without it also. A spinning disk is too slow, and swapping to flash memory wears it out. Meanwhile supercomputers will normally run a specialized application designed to fit into physical RAM. It's the medium-sized systems that still use swap, as a kind of last resort before breaking out the OOM killer. I think this middle space is likely to shrink in the years to come.

I take your point that programs may allocate a huge address space and then use little of it. That's a slightly different issue from swap: no 64-bit system has a swap file big enough for the whole virtual address space that some process might make, and you can have huge (but mostly empty) address spaces with no swap at all. But it would invalidate the property that access to user memory can never block. If the page had been allocated but not touched, a page fault would still be needed on first use.

(*) I know this rule came from various old systems and Unix variants in simpler times. I use it as a rough example of a fairly generous allocation of swap space, not that I am advocating it on current systems. My point is that even if swap is much bigger than RAM, that's still less than an order of magnitude to overcome.


to post comments

"User-space data may not be resident in RAM"

Posted Jul 9, 2020 8:14 UTC (Thu) by farnz (subscriber, #17727) [Link] (2 responses)

My Android devices do have swap - it's backed by a zram compressed RAM device, but it's swap nonetheless.

"User-space data may not be resident in RAM"

Posted Jul 9, 2020 11:03 UTC (Thu) by epa (subscriber, #39769) [Link] (1 responses)

Thanks for the correction. So Fedora is now catching up to Android in this regard.

I wonder whether for Android devices an old-fashioned task swapper might work better than demand paging, with an app that you've switched away from (and which does not run in the background) being swapped out to zram and swapped back in when you open it.

"User-space data may not be resident in RAM"

Posted Jul 9, 2020 11:29 UTC (Thu) by farnz (subscriber, #17727) [Link]

Android effectively has that, by requiring all apps to be capable of writing their own state to storage and exiting while backgrounded. However, swap helps because it allows more processes to sit idle in memory, ready for an on-demand "instant" switch instead of a slightly slower restore from storage.

"User-space data may not be resident in RAM"

Posted Jul 9, 2020 9:40 UTC (Thu) by gray_-_wolf (subscriber, #131074) [Link]

> eliminate swap altogether.

I like to be able to hibernate my machine though...


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