The patch titled Subject: mm: introduce pmd_to_pte_t() has been added to the -mm tree. Its filename is mm-introduce-pmd_to_pte_t.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: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Subject: mm: introduce pmd_to_pte_t() Casting pmd into pte_t to handle thp is strongly architecture dependent. This patch introduces a new function to separate this dependency from independent part. Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Andi Kleen <andi@xxxxxxxxxxxxxx> Cc: Wu Fengguang <fengguang.wu@xxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/x86/include/asm/pgtable.h | 5 +++++ fs/proc/task_mmu.c | 4 ++-- include/asm-generic/pgtable.h | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff -puN arch/x86/include/asm/pgtable.h~mm-introduce-pmd_to_pte_t arch/x86/include/asm/pgtable.h --- a/arch/x86/include/asm/pgtable.h~mm-introduce-pmd_to_pte_t +++ a/arch/x86/include/asm/pgtable.h @@ -165,6 +165,11 @@ static inline int has_transparent_hugepa { return cpu_has_pse; } +/* Caller must confirm that a given pmd points to a hugepage. */ +static inline pte_t pmd_to_pte_t(pmd_t *pmd) +{ + return *(pte_t *)pmd; +} #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ static inline pte_t pte_set_flags(pte_t pte, pteval_t set) diff -puN fs/proc/task_mmu.c~mm-introduce-pmd_to_pte_t fs/proc/task_mmu.c --- a/fs/proc/task_mmu.c~mm-introduce-pmd_to_pte_t +++ a/fs/proc/task_mmu.c @@ -395,7 +395,7 @@ static int smaps_pte_range(pmd_t *pmd, u spinlock_t *ptl; if (pmd_trans_huge_lock(pmd, vma)) { - smaps_pte_entry(*(pte_t *)pmd, addr, HPAGE_PMD_SIZE, walk); + smaps_pte_entry(pmd_to_pte_t(pmd), addr, HPAGE_PMD_SIZE, walk); spin_unlock(&walk->mm->page_table_lock); mss->anonymous_thp += HPAGE_PMD_SIZE; return 0; @@ -967,7 +967,7 @@ static int gather_pte_stats(pmd_t *pmd, md = walk->private; if (pmd_trans_huge_lock(pmd, md->vma)) { - pte_t huge_pte = *(pte_t *)pmd; + pte_t huge_pte = pmd_to_pte_t(pmd); struct page *page; page = can_gather_numa_stats(huge_pte, md->vma, addr); diff -puN include/asm-generic/pgtable.h~mm-introduce-pmd_to_pte_t include/asm-generic/pgtable.h --- a/include/asm-generic/pgtable.h~mm-introduce-pmd_to_pte_t +++ a/include/asm-generic/pgtable.h @@ -434,6 +434,10 @@ static inline int pmd_trans_splitting(pm { return 0; } +static inline pte_t pmd_to_pte_t(pmd_t *pmd) +{ + return 0; +} #ifndef __HAVE_ARCH_PMD_WRITE static inline int pmd_write(pmd_t pmd) { _ Subject: Subject: mm: introduce pmd_to_pte_t() Patches currently in -mm which might be from n-horiguchi@xxxxxxxxxxxxx are pagemap-avoid-splitting-thp-when-reading-proc-pid-pagemap.patch thp-optimize-away-unnecessary-page-table-locking.patch pagemap-export-kpf_thp.patch pagemap-document-kpf_thp-and-make-page-types-aware-of-it.patch mm-introduce-pmd_to_pte_t.patch pagemap-introduce-data-structure-for-pagemap-entry.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