Commit 25ca1d6c02fe1c6d90d918867ef670d323725458

Authored by Namhyung Kim
Committed by Linus Torvalds
1 parent e6223a3b19

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>

Showing 2 changed files with 10 additions and 2 deletions Side-by-side Diff

... ... @@ -1034,7 +1034,15 @@
1034 1034  
1035 1035 int vma_wants_writenotify(struct vm_area_struct *vma);
1036 1036  
1037   -extern pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl);
  1037 +extern pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
  1038 + spinlock_t **ptl);
  1039 +static inline pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr,
  1040 + spinlock_t **ptl)
  1041 +{
  1042 + pte_t *ptep;
  1043 + __cond_lock(*ptl, ptep = __get_locked_pte(mm, addr, ptl));
  1044 + return ptep;
  1045 +}
1038 1046  
1039 1047 #ifdef __PAGETABLE_PUD_FOLDED
1040 1048 static inline int __pud_alloc(struct mm_struct *mm, pgd_t *pgd,
... ... @@ -1591,7 +1591,7 @@
1591 1591 }
1592 1592 #endif /* CONFIG_ELF_CORE */
1593 1593  
1594   -pte_t *get_locked_pte(struct mm_struct *mm, unsigned long addr,
  1594 +pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
1595 1595 spinlock_t **ptl)
1596 1596 {
1597 1597 pgd_t * pgd = pgd_offset(mm, addr);