mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
mm, thp: move ptl taking inside page_check_address_pmd()
With split page table lock we can't know which lock we need to take before we find the relevant pmd. Let's move lock taking inside the function. Signed-off-by: Naoya Horiguchi <[email protected]> Signed-off-by: Kirill A. Shutemov <[email protected]> Tested-by: Alex Thorlton <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: "Eric W . Biederman" <[email protected]> Cc: "Paul E . McKenney" <[email protected]> Cc: Al Viro <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Dave Jones <[email protected]> Cc: David Howells <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Kees Cook <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michael Kerrisk <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Robin Holt <[email protected]> Cc: Sedat Dilek <[email protected]> Cc: Srikar Dronamraju <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
bf929152e9
commit
117b0791ac
3 changed files with 34 additions and 25 deletions
13
mm/rmap.c
13
mm/rmap.c
|
|
@ -665,25 +665,23 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma,
|
|||
unsigned long *vm_flags)
|
||||
{
|
||||
struct mm_struct *mm = vma->vm_mm;
|
||||
spinlock_t *ptl;
|
||||
int referenced = 0;
|
||||
|
||||
if (unlikely(PageTransHuge(page))) {
|
||||
pmd_t *pmd;
|
||||
|
||||
spin_lock(&mm->page_table_lock);
|
||||
/*
|
||||
* rmap might return false positives; we must filter
|
||||
* these out using page_check_address_pmd().
|
||||
*/
|
||||
pmd = page_check_address_pmd(page, mm, address,
|
||||
PAGE_CHECK_ADDRESS_PMD_FLAG);
|
||||
if (!pmd) {
|
||||
spin_unlock(&mm->page_table_lock);
|
||||
PAGE_CHECK_ADDRESS_PMD_FLAG, &ptl);
|
||||
if (!pmd)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (vma->vm_flags & VM_LOCKED) {
|
||||
spin_unlock(&mm->page_table_lock);
|
||||
spin_unlock(ptl);
|
||||
*mapcount = 0; /* break early from loop */
|
||||
*vm_flags |= VM_LOCKED;
|
||||
goto out;
|
||||
|
|
@ -692,10 +690,9 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma,
|
|||
/* go ahead even if the pmd is pmd_trans_splitting() */
|
||||
if (pmdp_clear_flush_young_notify(vma, address, pmd))
|
||||
referenced++;
|
||||
spin_unlock(&mm->page_table_lock);
|
||||
spin_unlock(ptl);
|
||||
} else {
|
||||
pte_t *pte;
|
||||
spinlock_t *ptl;
|
||||
|
||||
/*
|
||||
* rmap might return false positives; we must filter
|
||||
|
|
|
|||
Loading…
Reference in a new issue