Conversation

Okay, why does `swapoff` exist on Linux? It's completely useless as far as I can tell. It's been running for 24h to swap in like 1.5GB of used swap or so, on a largely idle server with >32GB free RAM. How can it be *this* hilariously inefficient?
11
61
Replying to and
There's a swap cache to track the pages in swap efficiently, but if they're not cached, dealing with them is incredibly expensive. The way it works is especially horrific with a modern SSD or even more so with in-memory swap like zram. You're really far better off just rebooting.
1
10
Replying to and
Usually, reading in the pages from swap is triggered by a page fault, so it already has the metadata to deal with the page and doesn't need to find it. They don't bother storing any metadata with the pages to deal with them quickly because it's not needed for the normal usage.
1
2
Show replies