Quoting the Linux Programmer's Manual (man 2 mlock
):
mlock()
,mlock2()
, andmlockall()
lock part or all of the calling process's virtual address space into RAM, preventing that memory from being paged to the swap area.
How does this work with respect to hibernation? Can a process using mlock()
be hibernated at all? What are the semantics after resuming from hibernation?
It depends on your system. Linux manual for
mlock
says:Some tools are really affected by
mlock
:swsusp
says it can't hybernatemlock
-ed pages.armory
, which usesmlock
, can't be restored after hybernation: