Skip to content

Commit 8cc931e

Browse files
kvaneeshtorvalds
authored andcommitted
powerpc/mm: update pmdp_invalidate to return old pmd value
It's required to avoid losing dirty and accessed bits. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Kirill A. Shutemov <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Michal Hocko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent b6b34b2 commit 8cc931e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

arch/powerpc/include/asm/book3s/64/pgtable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,8 @@ static inline pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm,
11371137
}
11381138

11391139
#define __HAVE_ARCH_PMDP_INVALIDATE
1140-
extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
1141-
pmd_t *pmdp);
1140+
extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
1141+
pmd_t *pmdp);
11421142

11431143
#define __HAVE_ARCH_PMDP_HUGE_SPLIT_PREPARE
11441144
static inline void pmdp_huge_split_prepare(struct vm_area_struct *vma,

arch/powerpc/mm/pgtable-book3s64.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,19 @@ void serialize_against_pte_lookup(struct mm_struct *mm)
9090
* We use this to invalidate a pmdp entry before switching from a
9191
* hugepte to regular pmd entry.
9292
*/
93-
void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
93+
pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
9494
pmd_t *pmdp)
9595
{
96-
pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT, 0);
96+
unsigned long old_pmd;
97+
98+
old_pmd = pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT, 0);
9799
flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
98100
/*
99101
* This ensures that generic code that rely on IRQ disabling
100102
* to prevent a parallel THP split work as expected.
101103
*/
102104
serialize_against_pte_lookup(vma->vm_mm);
105+
return __pmd(old_pmd);
103106
}
104107

105108
static pmd_t pmd_set_protbits(pmd_t pmd, pgprot_t pgprot)

0 commit comments

Comments
 (0)