Live data from Hacker News

Modernizing Linux swapping: introducing the swap table

lwn.net

131–132 of 132 posts

Re: Modernizing Linux swapping: introducing the swap table

#131
post #78

Earlier quoted context omitted.

Alt+[SysRq,f] Or Alt+[SysRq,h] for help

No effect, captain. In 30 years of using desktop Linux I've never been able to interrupt a swapstorm. The only way out is long-press the power button.

It always works for me, including on SBCs over TTL serial port. Always. Never had a situation where invoking the OOM killer by sysrq didn't solve the swap storm.

On your system it probably doesn't work at all, not even when idle. It can only be 3 reasons:

  - Your kernel doesn't have it. You probably have a generic kernel provided by the package manager without this feature enabled. I can't really help you here. I always build my own kernel from source (+ patches).

  - Something hijacks your keyboard input. If you have a console already opened and logged in as root, you can "echo f > /proc/sysrq-trigger". Else, you can try setting up a permanent serial console and send the command from another computer. CTRL+2 then the command letter (f). The magic sysrq key over serial console is a separate kernel option that needs to be enabled.

  - You're doing it wrong. On laptop keyboards, keyboards less than 104/105 keys, sysrq is one of the first keys to be removed. Getting it pressed with Fn combinations... Good luck with that!

Re: Modernizing Linux swapping: introducing the swap table

#132

Earlier quoted context omitted.

> You seem to be very certain about that inevitable memory leak. It is fashionable to disable swap nowadays because everyone has been bitten by a swap thrashing event. Read other comments. > A memory leak does not lead to thrashing. By definition if you have a leak the memory isn't used, so it goes to swap and stays there. You assume that leaked memory is inactive and goes to swap. This is not true. Chrome, Gnome, wh…

> It is fashionable to disable swap nowadays because everyone has been bitten by a swap thrashing event. If they disable swap they will get hit by the OOM killer. You seem to prefer it over slowing down. I guess that's a personal preference. However, I think it is misleading to say people are being bitten by a swap thrashing event. The "event" was them running out of RAM. Unpleasant things will happen as a consequenc…

> You seem to prefer it over slowing down.

An unresponsive system is not a slowdown. You keep ignoring that.

>> You assume that leaked memory is inactive and goes to swap. This is not true.

> At best, you can say "it's not always true".

You skipped my sentence that was specifying the scope when "it's not always true", and now you pretend that I'm making a categorical generalized statement. This is a silly attempt at a "strawman".

>> It means that the system wasn't out of memory yet.

> Of course it wasn't out of memory. It had lots of swap. That's the whole point of providing that swap - so you can rescue it!

Swap is not RAM. When the free RAM is below the low watermark, the kernel switches to direct reclaim and blocks tasks that require free memory pages. Blocking of tasks happens regardless of swap. If you are able to log in and fork a new process, the system is not below the low watermark.

>> When it is unresponsive, you won't be able to enter commands into an already open shell.

> Again that's just plain wrong.

You are in denial.

> Provided no new work is arriving (time for a cup of coffee?) it will get done, and the thrashing will end.

This is false. A system can stay unresponsive much longer than a cup of coffee. There is no guarantee that the thrashing will end in a reasonable time.

> even Debian will give you twice RAM for small systems.

> The people who decided on that design choice aren't following some folk law on they read in some internet echo chamber.

That 2x RAM rule is exactly that - an old folk law. You can find it in SunOS/AIX/etc manuals or Usenet FAQs from the 80s and early 90s, before Linux existed.

> They've used real data.

You're hallucinating like an LLM. No one did any research or measurements to justify that 2x rule in Linux.

Post reply on HN