The patch titled Subject: mm/hugetlb: allow architectures to override huge_pte_clear() has been added to the -mm tree. Its filename is mm-hugetlb-allow-architectures-to-override-huge_pte_clear.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-allow-architectures-to-override-huge_pte_clear.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-allow-architectures-to-override-huge_pte_clear.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Punit Agrawal <punit.agrawal@xxxxxxx> Subject: mm/hugetlb: allow architectures to override huge_pte_clear() When unmapping a hugepage range, huge_pte_clear() is used to clear the page table entries that are marked as not present. huge_pte_clear() internally just ends up calling pte_clear() which does not correctly deal with hugepages consisting of contiguous page table entries. Add a size argument to address this issue and allow architectures to override huge_pte_clear() by wrapping it in a #ifndef block. Update s390 implementation with the size parameter as well. Note that the change only affects huge_pte_clear() - the other generic hugetlb functions don't need any change. Link: http://lkml.kernel.org/r/20170522162555.4313-1-punit.agrawal@xxxxxxx Signed-off-by: Punit Agrawal <punit.agrawal@xxxxxxx> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Steve Capper <steve.capper@xxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/s390/include/asm/hugetlb.h | 2 +- include/asm-generic/hugetlb.h | 4 +++- mm/hugetlb.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff -puN arch/s390/include/asm/hugetlb.h~mm-hugetlb-allow-architectures-to-override-huge_pte_clear arch/s390/include/asm/hugetlb.h --- a/arch/s390/include/asm/hugetlb.h~mm-hugetlb-allow-architectures-to-override-huge_pte_clear +++ a/arch/s390/include/asm/hugetlb.h @@ -39,7 +39,7 @@ static inline int prepare_hugepage_range #define arch_clear_hugepage_flags(page) do { } while (0) static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, - pte_t *ptep) + pte_t *ptep, unsigned long sz) { if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) pte_val(*ptep) = _REGION3_ENTRY_EMPTY; diff -puN include/asm-generic/hugetlb.h~mm-hugetlb-allow-architectures-to-override-huge_pte_clear include/asm-generic/hugetlb.h --- a/include/asm-generic/hugetlb.h~mm-hugetlb-allow-architectures-to-override-huge_pte_clear +++ a/include/asm-generic/hugetlb.h @@ -31,10 +31,12 @@ static inline pte_t huge_pte_modify(pte_ return pte_modify(pte, newprot); } +#ifndef huge_pte_clear static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, - pte_t *ptep) + pte_t *ptep, unsigned long sz) { pte_clear(mm, addr, ptep); } +#endif #endif /* _ASM_GENERIC_HUGETLB_H */ diff -puN mm/hugetlb.c~mm-hugetlb-allow-architectures-to-override-huge_pte_clear mm/hugetlb.c --- a/mm/hugetlb.c~mm-hugetlb-allow-architectures-to-override-huge_pte_clear +++ a/mm/hugetlb.c @@ -3351,7 +3351,7 @@ void __unmap_hugepage_range(struct mmu_g * unmapped and its refcount is dropped, so just clear pte here. */ if (unlikely(!pte_present(pte))) { - huge_pte_clear(mm, address, ptep); + huge_pte_clear(mm, address, ptep, sz); spin_unlock(ptl); continue; } _ Patches currently in -mm which might be from punit.agrawal@xxxxxxx are mm-gup-ensure-real-head-page-is-ref-counted-when-using-hugepages.patch mm-hugetlb-add-size-parameter-to-huge_pte_offset.patch mm-hugetlb-allow-architectures-to-override-huge_pte_clear.patch mm-hugetlb-introduce-set_huge_swap_pte_at-helper.patch mm-rmap-use-correct-helper-when-poisoning-hugepages.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html