It is my understanding that pages in memory containing things like program text and shared libraries that have associated real world files will actually map to that associated file instead of swap (i.e. map to something like a segment of /usr/bin/ls). Therefore when the kernel frees up memory it doesn't need to copy those pages to swap since they can be copied back into memory from the associated file when a page fault occurs.

As a result we only use swap space for anonymous pages (i.e. pages in memory that are not associated with some real world file). Given this fact, I would assume a large portion of memory pages will never need to be copied to swap space because they are just copied into memory directly from the associated real world file as needed. So, my question is this: why does hibernation require a swap space roughly equal to our total system memory when a large portion of those memory pages don't map to swap space at all?

1 Answer 1


It doesn’t. The default goal for hibernation images (see the image_size setting) is approximately 2/5 of the amount of installed memory.

  • "installed memory" of which up to a half could be consumed in tmpfs. So wouldn't it be safer to assume 1/2+2/5=0,7 ?
    – MC68020
    Jan 16 at 7:16
  • Why half? tmpfs has a default maximum size of half of memory per file system, but it’s just a default. As far as hibernation is concerned, most of the gains come from compression, not just skipping file-backed pages. My point was really that hibernation doesn’t need as much room as installed memory, that’s all. Jan 16 at 7:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .