News for hackers. Stuff that matters.
Re:Swap, swap, swap, and bad places to work by Diggsey on Friday August 09, 2019 @06:53AM (#20653096)
Maybe if the kernel behaved optimally it wouldn't be any different, but empirically it seems like it does help.

My guess would be that if it's all RAM, then the kernel will happily use all of it for IO buffers, etc. and make no attempt to reduce its usage until actually necessary. If some of it is swap, then the kernel will (over time) try to reduce the size of its IO buffers until swap is no longer needed, but that de-allocation doesn't need to happen immediately, or block the rest of the system whilst it does happen.

Maybe there is a way to have that "high water mark" without needing swap - reserve 500M to be only used in "emergencies" - I don't know the details of the linux kernel well enough to know if that's a possibility.

Re:Swap, swap, swap, and bad places to work by tomsmeding on Friday August 09, 2019 @01:01PM (#20656206)
Now I'm suddenly wondering if this isn't really easy after all (or rather: should be really easy if all was well). If Linux behaves better when it has some slack space past the normal RAM that it doesn't like to put stuff in but will when necessary (i.e. swap), let it do the exact same thing to the last portion of your RAM. In other words: make a swap file of, say, 10% of your memory size, and put it in a tmpfs. Linux probably doesn't want that I believe, but it would, if working, give the results you want.
Re:Swap, swap, swap, and bad places to work by Dylan16807 on Friday August 09, 2019 @01:04PM (#20656230)
> make a swap file of, say, 10% of your memory size, and put it in a tmpfs

You're looking for zram, I believe.