]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm: remove mk_huge_pte()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 2 Apr 2025 18:17:03 +0000 (19:17 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:04 +0000 (17:48 -0700)
The only remaining user of mk_huge_pte() is the debug code, so remove the
API and replace its use with pfn_pte() which lets us remove the conversion
to a page first.  We should always call arch_make_huge_pte() to turn this
PTE into a huge PTE before operating on it with huge_pte_mkdirty() etc.

Link: https://lkml.kernel.org/r/20250402181709.2386022-10-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Richard Weinberger <richard@nod.at>
Cc: <x86@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/asm-generic/hugetlb.h
mm/debug_vm_pgtable.c

index 2afc95bf1655fb10b2cc2452457338d5fb799ed0..3e0a8fe9b10828967b9471757c3d0f94cb1f7b4d 100644 (file)
@@ -5,11 +5,6 @@
 #include <linux/swap.h>
 #include <linux/swapops.h>
 
-static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
-{
-       return mk_pte(page, pgprot);
-}
-
 static inline unsigned long huge_pte_write(pte_t pte)
 {
        return pte_write(pte);
index bc748f700a9e114c45a4718c04a602df3f0db94d..7731b238b5340ff8208ad7620c55cf98e3a2ed80 100644 (file)
@@ -910,26 +910,18 @@ static void __init swap_migration_tests(struct pgtable_debug_args *args)
 #ifdef CONFIG_HUGETLB_PAGE
 static void __init hugetlb_basic_tests(struct pgtable_debug_args *args)
 {
-       struct page *page;
        pte_t pte;
 
        pr_debug("Validating HugeTLB basic\n");
-       /*
-        * Accessing the page associated with the pfn is safe here,
-        * as it was previously derived from a real kernel symbol.
-        */
-       page = pfn_to_page(args->fixed_pmd_pfn);
-       pte = mk_huge_pte(page, args->page_prot);
+       pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot);
+       pte = arch_make_huge_pte(pte, PMD_SHIFT, VM_ACCESS_FLAGS);
 
+#ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB
+       WARN_ON(!pte_huge(pte));
+#endif
        WARN_ON(!huge_pte_dirty(huge_pte_mkdirty(pte)));
        WARN_ON(!huge_pte_write(huge_pte_mkwrite(huge_pte_wrprotect(pte))));
        WARN_ON(huge_pte_write(huge_pte_wrprotect(huge_pte_mkwrite(pte))));
-
-#ifdef CONFIG_ARCH_WANT_GENERAL_HUGETLB
-       pte = pfn_pte(args->fixed_pmd_pfn, args->page_prot);
-
-       WARN_ON(!pte_huge(arch_make_huge_pte(pte, PMD_SHIFT, VM_ACCESS_FLAGS)));
-#endif /* CONFIG_ARCH_WANT_GENERAL_HUGETLB */
 }
 #else  /* !CONFIG_HUGETLB_PAGE */
 static void __init hugetlb_basic_tests(struct pgtable_debug_args *args) { }