The patch titled Subject: mm: exclude HugeTLB pages from THP page_mapped() logic has been added to the -mm tree. Its filename is mm-exclude-hugetlb-pages-from-thp-page_mapped-logic.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-exclude-hugetlb-pages-from-thp-page_mapped-logic.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-exclude-hugetlb-pages-from-thp-page_mapped-logic.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: Steve Capper <steve.capper@xxxxxxx> Subject: mm: exclude HugeTLB pages from THP page_mapped() logic HugeTLB pages cannot be split, so we use the compound_mapcount to track rmaps. Currently page_mapped() will check the compound_mapcount, but will also go through the constituent pages of a THP compound page and query the individual _mapcount's too. Unfortunately, page_mapped() does not distinguish between HugeTLB and THP compound pages and assumes that a compound page always needs to have HPAGE_PMD_NR pages querying. For most cases when dealing with HugeTLB this is just inefficient, but for scenarios where the HugeTLB page size is less than the pmd block size (e.g. when using contiguous bit on ARM) this can lead to crashes. This patch adjusts the page_mapped function such that we skip the unnecessary THP reference checks for HugeTLB pages. Fixes: e1534ae95004 ("mm: differentiate page_mapped() from page_mapcount() for compound pages") Signed-off-by: Steve Capper <steve.capper@xxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [4.4+] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/mm.h | 2 ++ 1 file changed, 2 insertions(+) diff -puN include/linux/mm.h~mm-exclude-hugetlb-pages-from-thp-page_mapped-logic include/linux/mm.h --- a/include/linux/mm.h~mm-exclude-hugetlb-pages-from-thp-page_mapped-logic +++ a/include/linux/mm.h @@ -1031,6 +1031,8 @@ static inline bool page_mapped(struct pa page = compound_head(page); if (atomic_read(compound_mapcount_ptr(page)) >= 0) return true; + if (PageHuge(page)) + return false; for (i = 0; i < hpage_nr_pages(page); i++) { if (atomic_read(&page[i]._mapcount) >= 0) return true; _ Patches currently in -mm which might be from steve.capper@xxxxxxx are mm-exclude-hugetlb-pages-from-thp-page_mapped-logic.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