aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/vm/unevictable-lru.txt
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.cz>2015-06-24 19:57:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-24 20:49:44 -0400
commit9b012a29a300ea780d919205906d00d15cc6286e (patch)
treebfeef7ea3414bab1035fb8bbfd08c3d7b368139d /Documentation/vm/unevictable-lru.txt
parent22cc877b32202b6d82e580bc6b3b445531659d3e (diff)
Documentation/vm/unevictable-lru.txt: clarify MAP_LOCKED behavior
There is a very subtle difference between mmap()+mlock() vs mmap(MAP_LOCKED) semantic. The former one fails if the population of the area fails while the later one doesn't. This basically means that mmap(MAPLOCKED) areas might see major fault after mmap syscall returns which is not the case for mlock. mmap man page has already been altered but Documentation/vm/unevictable-lru.txt deserves a clarification as well. Signed-off-by: Michal Hocko <mhocko@suse.cz> Reported-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/vm/unevictable-lru.txt')
-rw-r--r--Documentation/vm/unevictable-lru.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/Documentation/vm/unevictable-lru.txt b/Documentation/vm/unevictable-lru.txt
index 3be0bfc4738d..32ee3a67dba2 100644
--- a/Documentation/vm/unevictable-lru.txt
+++ b/Documentation/vm/unevictable-lru.txt
@@ -467,7 +467,13 @@ mmap(MAP_LOCKED) SYSTEM CALL HANDLING
467 467
468In addition the mlock()/mlockall() system calls, an application can request 468In addition the mlock()/mlockall() system calls, an application can request
469that a region of memory be mlocked supplying the MAP_LOCKED flag to the mmap() 469that a region of memory be mlocked supplying the MAP_LOCKED flag to the mmap()
470call. Furthermore, any mmap() call or brk() call that expands the heap by a 470call. There is one important and subtle difference here, though. mmap() + mlock()
471will fail if the range cannot be faulted in (e.g. because mm_populate fails)
472and returns with ENOMEM while mmap(MAP_LOCKED) will not fail. The mmaped
473area will still have properties of the locked area - aka. pages will not get
474swapped out - but major page faults to fault memory in might still happen.
475
476Furthermore, any mmap() call or brk() call that expands the heap by a
471task that has previously called mlockall() with the MCL_FUTURE flag will result 477task that has previously called mlockall() with the MCL_FUTURE flag will result
472in the newly mapped memory being mlocked. Before the unevictable/mlock 478in the newly mapped memory being mlocked. Before the unevictable/mlock
473changes, the kernel simply called make_pages_present() to allocate pages and 479changes, the kernel simply called make_pages_present() to allocate pages and