[Gllug] Hibernation with less swap space than memory?

Richard Jones rich at annexia.org
Sat Jul 17 06:00:22 UTC 2010


On Sat, Jul 17, 2010 at 06:01:27AM +0100, general_email at technicalbloke.com wrote:
> I've just put some more memory in my computer and now I have more of it 
> than I have swap space. It still seems to hibernate and resume OK but 
> I'm assuming that's only because I have less programs in ram than I have 
> available swap. Does anyone know what will happen if I try to hibernate 
> when I have more code in ram than I have swap space available? Bad 
> things will abound I'm sure but I'm just curious to know exactly what.

There's nothing in the documentation about this, but reading the
source, it tries to get rid of everything which is file-backed before
writing the remainder to the swap partition.  If there's not enough
free swap then the kernel will print an error message ("Not enough
free swap") and return an error to userspace, but it's not clear what
happens then -- presumably if userspace is well written it should be
able to recover and you'll just see the error message.

When you say "code in RAM", note that "code" is usually backed by the
original executable file, and is the easiest thing to get kicked out
when memory gets tight.  It's not even swapped.  It's just deleted
entirely and reloaded on demand from the backing file.  What you have
to worry about are anonymous memory allocations with no file backing,
such as heap allocations in C programs.

Rich.

-- 
Richard Jones
Red Hat
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list