aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-26 14:21:59 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 16:52:09 -0700
commit25ca1d6c02fe1c6d90d918867ef670d323725458 (patch)
treede1709dd1dc7e0b9e9bd91840beb02f12e56b7e0
parente6223a3b19421e3a8df1352d21fd0d71093f44ae (diff)
downloadvexpress-lsk-25ca1d6c02fe1c6d90d918867ef670d323725458.tar.gz
mm: wrap get_locked_pte() using __cond_lock()
The get_locked_pte() conditionally grabs 'ptl' in case of returning non-NULL. This leads sparse to complain about context imbalance. Rename and wrap it using __cond_lock() to make sparse happy. 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>
-rw-r--r--include/linux/mm.h10
-rw-r--r--mm/memory.c2
2 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3bf46655b50..721f451c302 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1034,7 +1034,15 @@ extern void unregister_shrinker(struct shrinker *);
int vma_wants_writenotify(struct vm_area_struct *vma);
-extern pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl);
+extern pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
+ spinlock_t **ptl);
+static inline pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr,
+ spinlock_t **ptl)
+{
+ pte_t *ptep;
+ __cond_lock(*ptl, ptep = __get_locked_pte(mm, addr, ptl));
+ return ptep;
+}
#ifdef __PAGETABLE_PUD_FOLDED
static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
diff --git a/mm/memory.c b/mm/memory.c
index 714c4438d88..4ce24a4d5d4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1591,7 +1591,7 @@ struct page *get_dump_page(unsigned long addr)
}
#endif /* CONFIG_ELF_CORE */
-pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr,
+pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
spinlock_t **ptl)
{
pgd_t * pgd = pgd_offset(mm, addr);