mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
mm, thp: change pmd_trans_huge_lock() to return taken lock
With split ptlock it's important to know which lock pmd_trans_huge_lock() took. This patch adds one more parameter to the function to return the lock. In most places migration to new api is trivial. Exception is move_huge_pmd(): we need to take two locks if pmd tables are different. 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
9a86cb7bdc
commit
bf929152e9
4 changed files with 46 additions and 31 deletions
|
|
@ -506,9 +506,9 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
|
|||
pte_t *pte;
|
||||
spinlock_t *ptl;
|
||||
|
||||
if (pmd_trans_huge_lock(pmd, vma) == 1) {
|
||||
if (pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
|
||||
smaps_pte_entry(*(pte_t *)pmd, addr, HPAGE_PMD_SIZE, walk);
|
||||
spin_unlock(&walk->mm->page_table_lock);
|
||||
spin_unlock(ptl);
|
||||
mss->anonymous_thp += HPAGE_PMD_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -999,13 +999,14 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
|
|||
{
|
||||
struct vm_area_struct *vma;
|
||||
struct pagemapread *pm = walk->private;
|
||||
spinlock_t *ptl;
|
||||
pte_t *pte;
|
||||
int err = 0;
|
||||
pagemap_entry_t pme = make_pme(PM_NOT_PRESENT(pm->v2));
|
||||
|
||||
/* find the first VMA at or above 'addr' */
|
||||
vma = find_vma(walk->mm, addr);
|
||||
if (vma && pmd_trans_huge_lock(pmd, vma) == 1) {
|
||||
if (vma && pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
|
||||
int pmd_flags2;
|
||||
|
||||
if ((vma->vm_flags & VM_SOFTDIRTY) || pmd_soft_dirty(*pmd))
|
||||
|
|
@ -1023,7 +1024,7 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
|
|||
if (err)
|
||||
break;
|
||||
}
|
||||
spin_unlock(&walk->mm->page_table_lock);
|
||||
spin_unlock(ptl);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1325,7 +1326,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
|
|||
|
||||
md = walk->private;
|
||||
|
||||
if (pmd_trans_huge_lock(pmd, md->vma) == 1) {
|
||||
if (pmd_trans_huge_lock(pmd, md->vma, &ptl) == 1) {
|
||||
pte_t huge_pte = *(pte_t *)pmd;
|
||||
struct page *page;
|
||||
|
||||
|
|
@ -1333,7 +1334,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
|
|||
if (page)
|
||||
gather_stats(page, md, pte_dirty(huge_pte),
|
||||
HPAGE_PMD_SIZE/PAGE_SIZE);
|
||||
spin_unlock(&walk->mm->page_table_lock);
|
||||
spin_unlock(ptl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue