]> git.ipfire.org Git - thirdparty/man-pages.git/commit
mlock.2: Document that fork() after mlock() may be a bad idea in a RT process
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Tue, 30 Aug 2016 08:59:11 +0000 (10:59 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Tue, 30 Aug 2016 19:23:08 +0000 (07:23 +1200)
commitfb08a0954ecfde61ad671ce60ed22c358298fe28
tree557855f0717901129fb461562cc4605a988578d1
parent46305699f773f3500d8527f6987500db230aa022
mlock.2: Document that fork() after mlock() may be a bad idea in a RT process

fork() will remove the write PTE bit from the page table on each
VMA which will be copied via COW. As such, the memory is available
but marked read only in the page table and will fault on write
access.  This renders the previous mlock() operation almost
useless because in a multithreaded application a realtime thread
may block on mmap_sem while a thread with low priority is holding
the mmap_sem (for instance because it is allocating memory which
needs to be mapped in).

There is actually nothing we can do to mitigate the outcome. We could
add a warning to the kernel for people that are not yet aware of the
updated documentation.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
man2/mlock.2