The patch titled Subject: mm: remove __ARCH_HAS_4LEVEL_HACK and include/asm-generic/4level-fixup.h has been added to the -mm tree. Its filename is mm-remove-__arch_has_4level_hack-and-include-asm-generic-4level-fixuph.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-remove-__arch_has_4level_hack-and-include-asm-generic-4level-fixuph.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-remove-__arch_has_4level_hack-and-include-asm-generic-4level-fixuph.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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxx> Subject: mm: remove __ARCH_HAS_4LEVEL_HACK and include/asm-generic/4level-fixup.h There are no architectures that use include/asm-generic/4level-fixup.h therefore it can be removed along with __ARCH_HAS_4LEVEL_HACK define. Link: http://lkml.kernel.org/r/1572938135-31886-14-git-send-email-rppt@xxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Cc: Anatoly Pugachev <matorola@xxxxxxxxx> Cc: Anton Ivanov <anton.ivanov@xxxxxxxxxxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: Greentime Hu <green.hu@xxxxxxxxx> Cc: Greg Ungerer <gerg@xxxxxxxxxxxxxx> Cc: Helge Deller <deller@xxxxxx> Cc: "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Cc: Jeff Dike <jdike@xxxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> Cc: Mark Salter <msalter@xxxxxxxxxx> Cc: Matt Turner <mattst88@xxxxxxxxx> Cc: Michal Simek <monstr@xxxxxxxxx> Cc: Peter Rosin <peda@xxxxxxxxxx> Cc: Richard Weinberger <richard@xxxxxx> Cc: Rolf Eike Beer <eike-kernel@xxxxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxx> Cc: Sam Creasey <sammy@xxxxxxxxx> Cc: Vincent Chen <deanbo422@xxxxxxxxx> Cc: Vineet Gupta <Vineet.Gupta1@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-generic/4level-fixup.h | 39 --------------------------- include/linux/mm.h | 10 +++--- mm/memory.c | 8 ----- 3 files changed, 5 insertions(+), 52 deletions(-) --- a/include/asm-generic/4level-fixup.h +++ /dev/null @@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _4LEVEL_FIXUP_H -#define _4LEVEL_FIXUP_H - -#define __ARCH_HAS_4LEVEL_HACK -#define __PAGETABLE_PUD_FOLDED 1 - -#define PUD_SHIFT PGDIR_SHIFT -#define PUD_SIZE PGDIR_SIZE -#define PUD_MASK PGDIR_MASK -#define PTRS_PER_PUD 1 - -#define pud_t pgd_t - -#define pmd_alloc(mm, pud, address) \ - ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \ - NULL: pmd_offset(pud, address)) - -#define pud_offset(pgd, start) (pgd) -#define pud_none(pud) 0 -#define pud_bad(pud) 0 -#define pud_present(pud) 1 -#define pud_ERROR(pud) do { } while (0) -#define pud_clear(pud) pgd_clear(pud) -#define pud_val(pud) pgd_val(pud) -#define pud_populate(mm, pud, pmd) pgd_populate(mm, pud, pmd) -#define pud_page(pud) pgd_page(pud) -#define pud_page_vaddr(pud) pgd_page_vaddr(pud) - -#undef pud_free_tlb -#define pud_free_tlb(tlb, x, addr) do { } while (0) -#define pud_free(mm, x) do { } while (0) - -#undef pud_addr_end -#define pud_addr_end(addr, end) (end) - -#include <asm-generic/5level-fixup.h> - -#endif --- a/include/linux/mm.h~mm-remove-__arch_has_4level_hack-and-include-asm-generic-4level-fixuph +++ a/include/linux/mm.h @@ -1853,12 +1853,12 @@ static inline void mm_dec_nr_ptes(struct int __pte_alloc(struct mm_struct *mm, pmd_t *pmd); int __pte_alloc_kernel(pmd_t *pmd); +#if defined(CONFIG_MMU) + /* - * The following ifdef needed to get the 4level-fixup.h header to work. - * Remove it when 4level-fixup.h has been removed. + * The following ifdef needed to get the 5level-fixup.h header to work. + * Remove it when 5level-fixup.h has been removed. */ -#if defined(CONFIG_MMU) && !defined(__ARCH_HAS_4LEVEL_HACK) - #ifndef __ARCH_HAS_5LEVEL_HACK static inline p4d_t *p4d_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address) @@ -1880,7 +1880,7 @@ static inline pmd_t *pmd_alloc(struct mm return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))? NULL: pmd_offset(pud, address); } -#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ +#endif /* CONFIG_MMU */ #if USE_SPLIT_PTE_PTLOCKS #if ALLOC_SPLIT_PTLOCKS --- a/mm/memory.c~mm-remove-__arch_has_4level_hack-and-include-asm-generic-4level-fixuph +++ a/mm/memory.c @@ -4191,19 +4191,11 @@ int __pmd_alloc(struct mm_struct *mm, pu smp_wmb(); /* See comment in __pte_alloc */ ptl = pud_lock(mm, pud); -#ifndef __ARCH_HAS_4LEVEL_HACK if (!pud_present(*pud)) { mm_inc_nr_pmds(mm); pud_populate(mm, pud, new); } else /* Another has populated it */ pmd_free(mm, new); -#else - if (!pgd_present(*pud)) { - mm_inc_nr_pmds(mm); - pgd_populate(mm, pud, new); - } else /* Another has populated it */ - pmd_free(mm, new); -#endif /* __ARCH_HAS_4LEVEL_HACK */ spin_unlock(ptl); return 0; } _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxx are userfaultfd-require-cap_sys_ptrace-for-uffd_feature_event_fork.patch alpha-use-pgtable-nopud-instead-of-4level-fixup.patch arm-nommu-use-pgtable-nopud-instead-of-4level-fixup.patch c6x-use-pgtable-nopud-instead-of-4level-fixup.patch m68k-nommu-use-pgtable-nopud-instead-of-4level-fixup.patch m68k-mm-use-pgtable-nopxd-instead-of-4level-fixup.patch microblaze-use-pgtable-nopmd-instead-of-4level-fixup.patch nds32-use-pgtable-nopmd-instead-of-4level-fixup.patch parisc-use-pgtable-nopxd-instead-of-4level-fixup.patch sparc32-use-pgtable-nopud-instead-of-4level-fixup.patch um-remove-unused-pxx_offset_proc-and-addr_pte-functions.patch um-add-support-for-folded-p4d-page-tables.patch mm-remove-__arch_has_4level_hack-and-include-asm-generic-4level-fixuph.patch