From: Arnd Bergmann <arnd@kernel.org>
To: linux-mm@kvack.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Andreas Larsson <andreas@gaisler.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
"David Hildenbrand (Arm)" <david@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Linus Walleij <linusw@kernel.org>,
"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
Lucas Stach <l.stach@pengutronix.de>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Malin Jonsson <malin.jonsson@est.tech>,
Matthew Wilcox <willy@infradead.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Michal Simek <monstr@monstr.eu>, Mike Rapoport <rppt@kernel.org>,
Nicholas Piggin <npiggin@gmail.com>, Nishanth Menon <nm@ti.com>,
Richard Weinberger <richard@nod.at>,
Russell King <linux@armlinux.org.uk>,
Thomas Gleixner <tglx@linutronix.de>,
linux-arm-kernel@lists.infradead.org,
linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
x86@kernel.org
Subject: [PATCH v3 09/10] mm: drop HIGHPTE support altogether
Date: Mon, 16 Nov 2026 13:48:31 +0100 [thread overview]
Message-ID: <20261116124832.662455-10-arnd@kernel.org> (raw)
In-Reply-To: <20261116124832.662455-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
With both x86 and arm having dropped CONFIG_HIGHPTE support, no
architecture is left using it, so remove the remnants in common code.
It is likely that further cleanups are possible in the page table
code but those are not obvious from the config options.
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/hugetlb.h | 5 +----
include/linux/mm.h | 1 -
include/linux/pgtable.h | 13 -------------
mm/pgtable-generic.c | 25 ++++++++++++-------------
mm/userfaultfd.c | 6 +-----
5 files changed, 14 insertions(+), 36 deletions(-)
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 58f755e70e96..7c6d191fdf50 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -178,7 +178,6 @@ void hugetlb_bootmem_set_nodes(void);
/* arch callbacks */
-#ifndef CONFIG_HIGHPTE
/*
* pte_offset_huge() and pte_alloc_huge() are helpers for those architectures
* which may go down to the lowest PTE level in their huge_pte_offset() and
@@ -193,7 +192,6 @@ static inline pte_t *pte_alloc_huge(struct mm_struct *mm, pmd_t *pmd,
{
return pte_alloc(mm, pmd) ? NULL : pte_offset_huge(pmd, address);
}
-#endif
pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long addr, unsigned long sz);
@@ -1047,9 +1045,8 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
*/
if (size >= PUD_SIZE)
return pud_lockptr(mm, (pud_t *) pte);
- else if (size >= PMD_SIZE || IS_ENABLED(CONFIG_HIGHPTE))
+ else if (size >= PMD_SIZE)
return pmd_lockptr(mm, (pmd_t *) pte);
- /* pte_alloc_huge() only applies with !CONFIG_HIGHPTE */
return ptep_lockptr(mm, pte);
}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6af3b7008f1a..019de55bd796 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -4025,7 +4025,6 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
static inline spinlock_t *ptep_lockptr(struct mm_struct *mm, pte_t *pte)
{
- BUILD_BUG_ON(IS_ENABLED(CONFIG_HIGHPTE));
BUILD_BUG_ON(MAX_PTRS_PER_PTE * sizeof(pte_t) > PAGE_SIZE);
return ptlock_ptr(virt_to_ptdesc(pte));
}
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index 780fe849ff8b..594c309b1475 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -100,23 +100,10 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long address)
#define pte_offset_kernel pte_offset_kernel
#endif
-#ifdef CONFIG_HIGHPTE
-#define __pte_map(pmd, address) \
- ((pte_t *)kmap_local_page(pmd_page(*(pmd))) + pte_index((address)))
-#define pte_unmap(pte) do { \
- kunmap_local((pte)); \
- rcu_read_unlock(); \
-} while (0)
-#else
-static inline pte_t *__pte_map(pmd_t *pmd, unsigned long address)
-{
- return pte_offset_kernel(pmd, address);
-}
static inline void pte_unmap(pte_t *pte)
{
rcu_read_unlock();
}
-#endif
void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable);
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index 6e83ce3801b8..f78b9d874b93 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -314,7 +314,7 @@ pte_t *__pte_offset_map(pmd_t *pmd, unsigned long addr, pmd_t *pmdvalp)
pmd_clear_bad(pmd);
goto nomap;
}
- return __pte_map(&pmdval, addr);
+ return pte_offset_kernel(&pmdval, addr);
nomap:
rcu_read_unlock();
return NULL;
@@ -353,11 +353,11 @@ pte_t *pte_offset_map_rw_nolock(struct mm_struct *mm, pmd_t *pmd,
* for read (or for write). In a few cases, it may be used with pmd pointing to
* a pmd_t already copied to or constructed on the stack.
*
- * When successful, it returns the pte pointer for addr, with its page table
- * kmapped if necessary (when CONFIG_HIGHPTE), and locked against concurrent
- * modification by software, with a pointer to that spinlock in ptlp (in some
- * configs mm->page_table_lock, in SPLIT_PTLOCK configs a spinlock in table's
- * struct page). pte_unmap_unlock(pte, ptl) to unlock and unmap afterwards.
+ * When successful, it returns the pte pointer for addr, locked against
+ * concurrent modification by software, with a pointer to that spinlock in ptlp
+ * (in some configs mm->page_table_lock, in SPLIT_PTLOCK configs a spinlock in
+ * table's struct page). pte_unmap_unlock(pte, ptl) to unlock and unmap
+ * afterwards.
*
* But it is unsuccessful, returning NULL with *ptlp unchanged, if there is no
* page table at *pmd: if, for example, the page table has just been removed,
@@ -366,13 +366,12 @@ pte_t *pte_offset_map_rw_nolock(struct mm_struct *mm, pmd_t *pmd,
* page table can be safely removed or replaced by THP while holding its lock.)
*
* pte_offset_map(pmd, addr), and its internal helper __pte_offset_map() above,
- * just returns the pte pointer for addr, its page table kmapped if necessary;
- * or NULL if there is no page table at *pmd. It does not attempt to lock the
- * page table, so cannot normally be used when the page table is to be updated,
- * or when entries read must be stable. But it does take rcu_read_lock(): so
- * that even when page table is racily removed, it remains a valid though empty
- * and disconnected table. Until pte_unmap(pte) unmaps and rcu_read_unlock()s
- * afterwards.
+ * just returns the pte pointer for addr, or NULL if there is no page table at
+ * *pmd. It does not attempt to lock the page table, so cannot normally be
+ * used when the page table is to be updated, or when entries read must be
+ * stable. But it does take rcu_read_lock(): so that even when page table is
+ * racily removed, it remains a valid though empty and disconnected table.
+ * Until pte_unmap(pte) unmaps and rcu_read_unlock()s afterwards.
*
* pte_offset_map_ro_nolock(mm, pmd, addr, ptlp), above, is like pte_offset_map();
* but when successful, it also outputs a pointer to the spinlock in ptlp - as
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 169f681f9849..f6bf476abdcd 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -1696,11 +1696,7 @@ static long move_pages_ptes(struct mm_struct *mm, pmd_t *dst_pmd, pmd_t *src_pmd
folio_unlock(src_folio);
folio_put(src_folio);
}
- /*
- * Unmap in reverse order (LIFO) to maintain proper kmap_local
- * index ordering when CONFIG_HIGHPTE is enabled. We mapped dst_pte
- * first, then src_pte, so we must unmap src_pte first, then dst_pte.
- */
+
if (src_pte)
pte_unmap(src_pte);
if (dst_pte)
--
2.53.0
next prev parent reply other threads:[~2026-11-16 12:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 12:48 [PATCH v3 00/10] mm: highmem cleanups Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 01/10] ARM: remove support for highmem on VIVT Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 02/10] ARM: drop CONFIG_HIGHPTE support Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 03/10] ARM: pxa: support arbitrary PAGE_OFFSET Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 04/10] powerpc: kvm: allow flexible PAGE_OFFSET Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 05/10] ARM: add CONFIG_VMSPLIT_2G_OPT option Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 06/10] arch/*: increase lowmem size to avoid highmem use Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 07/10] ARM: defconfig: turn off highmem in favor of CONFIG_VMSPLIT_2G_OPT Arnd Bergmann
2026-11-16 12:48 ` [PATCH v3 08/10] mm: remove ARCH_NEEDS_KMAP_HIGH_GET Arnd Bergmann
2026-11-16 12:48 ` Arnd Bergmann [this message]
2026-11-16 12:48 ` [PATCH v3 10/10] mm: print pte in __print_bad_page_map_pgtable() Arnd Bergmann
2026-11-16 13:00 ` Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116124832.662455-10-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andreas@gaisler.com \
--cc=arnd@arndb.de \
--cc=chleroy@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=hpa@zytor.com \
--cc=jgg@nvidia.com \
--cc=l.stach@pengutronix.de \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ljs@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=malin.jonsson@est.tech \
--cc=mingo@redhat.com \
--cc=monstr@monstr.eu \
--cc=mpe@ellerman.id.au \
--cc=nm@ti.com \
--cc=npiggin@gmail.com \
--cc=richard@nod.at \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox