diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-10-26 17:22:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:09 -0400 |
commit | 1b36ba815bd91f17e31277a44dd5c6b6a5a8d97e (patch) | |
tree | 9d68d66e780c619b01c5d8ddc93e19547b448142 /mm/memory.c | |
parent | e6219ec8195efd5640765e657810f262ad9d1a92 (diff) |
mm: wrap follow_pte() using __cond_lock()
The follow_pte() conditionally grabs *@ptlp in case of returning 0.
Rename and wrap it using __cond_lock() removes following warnings:
mm/memory.c:2337:9: warning: context imbalance in 'do_wp_page' - unexpected unlock
mm/memory.c:3142:19: warning: context imbalance in 'handle_mm_fault' - different lock contexts for basic block
Signed-off-by: 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/memory.c')
-rw-r--r-- | mm/memory.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c index 01bdf9dbbfac..861f7982dd54 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3351,7 +3351,7 @@ int in_gate_area_no_task(unsigned long addr) | |||
3351 | 3351 | ||
3352 | #endif /* __HAVE_ARCH_GATE_AREA */ | 3352 | #endif /* __HAVE_ARCH_GATE_AREA */ |
3353 | 3353 | ||
3354 | static int follow_pte(struct mm_struct *mm, unsigned long address, | 3354 | static int __follow_pte(struct mm_struct *mm, unsigned long address, |
3355 | pte_t **ptepp, spinlock_t **ptlp) | 3355 | pte_t **ptepp, spinlock_t **ptlp) |
3356 | { | 3356 | { |
3357 | pgd_t *pgd; | 3357 | pgd_t *pgd; |
@@ -3388,6 +3388,17 @@ out: | |||
3388 | return -EINVAL; | 3388 | return -EINVAL; |
3389 | } | 3389 | } |
3390 | 3390 | ||
3391 | static inline int follow_pte(struct mm_struct *mm, unsigned long address, | ||
3392 | pte_t **ptepp, spinlock_t **ptlp) | ||
3393 | { | ||
3394 | int res; | ||
3395 | |||
3396 | /* (void) is needed to make gcc happy */ | ||
3397 | (void) __cond_lock(*ptlp, | ||
3398 | !(res = __follow_pte(mm, address, ptepp, ptlp))); | ||
3399 | return res; | ||
3400 | } | ||
3401 | |||
3391 | /** | 3402 | /** |
3392 | * follow_pfn - look up PFN at a user virtual address | 3403 | * follow_pfn - look up PFN at a user virtual address |
3393 | * @vma: memory mapping | 3404 | * @vma: memory mapping |