On 2019-07-10 09:20:47 [-0700], Dave Hansen wrote: > On 7/10/19 7:41 AM, Sebastian Andrzej Siewior wrote: > > I did not expect a pagefault with mlockall(). I assume it has to do with > > memory compaction. > > mlock() doesn't technically prevent faults. From the manpage: > > > mlock(), mlock2(), and mlockall() lock part or all of the > > calling process's virtual address space into RAM, preventing that > > memory from being paged to the swap area. > I read that as basically saying there will be no major faults, but minor > faults are possible. It says "lock virtual address space into into RAM". I assumed that there will be no page faults because everything is locked. The problem (besides the delay caused by the context switch and fix up) is that a major fault (with might have happened at the same time in another thread) will block this minor fault even longer. Sebastian