diff options
-rw-r--r-- | include/linux/rmap.h | 15 | ||||
-rw-r--r-- | mm/rmap.c | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 5c98df68a953..07ea89c16761 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
@@ -230,7 +230,20 @@ int try_to_munlock(struct page *); | |||
230 | /* | 230 | /* |
231 | * Called by memory-failure.c to kill processes. | 231 | * Called by memory-failure.c to kill processes. |
232 | */ | 232 | */ |
233 | struct anon_vma *page_lock_anon_vma(struct page *page); | 233 | struct anon_vma *__page_lock_anon_vma(struct page *page); |
234 | |||
235 | static inline struct anon_vma *page_lock_anon_vma(struct page *page) | ||
236 | { | ||
237 | struct anon_vma *anon_vma; | ||
238 | |||
239 | __cond_lock(RCU, anon_vma = __page_lock_anon_vma(page)); | ||
240 | |||
241 | /* (void) is needed to make gcc happy */ | ||
242 | (void) __cond_lock(&anon_vma->root->lock, anon_vma); | ||
243 | |||
244 | return anon_vma; | ||
245 | } | ||
246 | |||
234 | void page_unlock_anon_vma(struct anon_vma *anon_vma); | 247 | void page_unlock_anon_vma(struct anon_vma *anon_vma); |
235 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); | 248 | int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); |
236 | 249 | ||
@@ -314,7 +314,7 @@ void __init anon_vma_init(void) | |||
314 | * Getting a lock on a stable anon_vma from a page off the LRU is | 314 | * Getting a lock on a stable anon_vma from a page off the LRU is |
315 | * tricky: page_lock_anon_vma rely on RCU to guard against the races. | 315 | * tricky: page_lock_anon_vma rely on RCU to guard against the races. |
316 | */ | 316 | */ |
317 | struct anon_vma *page_lock_anon_vma(struct page *page) | 317 | struct anon_vma *__page_lock_anon_vma(struct page *page) |
318 | { | 318 | { |
319 | struct anon_vma *anon_vma, *root_anon_vma; | 319 | struct anon_vma *anon_vma, *root_anon_vma; |
320 | unsigned long anon_mapping; | 320 | unsigned long anon_mapping; |
@@ -348,6 +348,8 @@ out: | |||
348 | } | 348 | } |
349 | 349 | ||
350 | void page_unlock_anon_vma(struct anon_vma *anon_vma) | 350 | void page_unlock_anon_vma(struct anon_vma *anon_vma) |
351 | __releases(&anon_vma->root->lock) | ||
352 | __releases(RCU) | ||
351 | { | 353 | { |
352 | anon_vma_unlock(anon_vma); | 354 | anon_vma_unlock(anon_vma); |
353 | rcu_read_unlock(); | 355 | rcu_read_unlock(); |