diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-05-24 20:12:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:18 -0400 |
commit | 6111e4ca6829a0e8b092b8e5eeb6b5366091f29c (patch) | |
tree | 12d0f6bf4dad72e6842b8d68b72f24fd23bb236c /mm | |
parent | 25aeeb046e695c3093a86aa9386128ffb3b1bc32 (diff) |
mm: improve page_lock_anon_vma() comment
A slightly more verbose comment to go along with the trickery in
page_lock_anon_vma().
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: David Miller <davem@davemloft.net>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/rmap.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -320,8 +320,22 @@ void __init anon_vma_init(void) | |||
320 | } | 320 | } |
321 | 321 | ||
322 | /* | 322 | /* |
323 | * Getting a lock on a stable anon_vma from a page off the LRU is | 323 | * Getting a lock on a stable anon_vma from a page off the LRU is tricky! |
324 | * tricky: page_lock_anon_vma rely on RCU to guard against the races. | 324 | * |
325 | * Since there is no serialization what so ever against page_remove_rmap() | ||
326 | * the best this function can do is return a locked anon_vma that might | ||
327 | * have been relevant to this page. | ||
328 | * | ||
329 | * The page might have been remapped to a different anon_vma or the anon_vma | ||
330 | * returned may already be freed (and even reused). | ||
331 | * | ||
332 | * All users of this function must be very careful when walking the anon_vma | ||
333 | * chain and verify that the page in question is indeed mapped in it | ||
334 | * [ something equivalent to page_mapped_in_vma() ]. | ||
335 | * | ||
336 | * Since anon_vma's slab is DESTROY_BY_RCU and we know from page_remove_rmap() | ||
337 | * that the anon_vma pointer from page->mapping is valid if there is a | ||
338 | * mapcount, we can dereference the anon_vma after observing those. | ||
325 | */ | 339 | */ |
326 | struct anon_vma *page_lock_anon_vma(struct page *page) | 340 | struct anon_vma *page_lock_anon_vma(struct page *page) |
327 | { | 341 | { |