]> www.infradead.org Git - users/willy/xarray.git/commitdiff
mm: drop is_huge_zero_pud()
authorPeter Xu <peterx@redhat.com>
Mon, 26 Aug 2024 20:43:36 +0000 (16:43 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 17 Sep 2024 08:06:58 +0000 (01:06 -0700)
It constantly returns false since 2017.  One assertion is added in 2019 but
it should never have triggered, IOW it means what is checked should be
asserted instead.

If it didn't exist for 7 years maybe it's good idea to remove it and only
add it when it comes.

Link: https://lkml.kernel.org/r/20240826204353.2228736-3-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Gavin Shan <gshan@redhat.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/huge_mm.h
mm/huge_memory.c

index e3896ebf0f94a52a17da033b11d1e982eaba0fce..ffca706bac81c8fc44a6d0c54c3d0735e26e53c0 100644 (file)
@@ -433,11 +433,6 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)
        return pmd_present(pmd) && READ_ONCE(huge_zero_pfn) == pmd_pfn(pmd);
 }
 
-static inline bool is_huge_zero_pud(pud_t pud)
-{
-       return false;
-}
-
 struct folio *mm_get_huge_zero_folio(struct mm_struct *mm);
 void mm_put_huge_zero_folio(struct mm_struct *mm);
 
@@ -578,11 +573,6 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)
        return false;
 }
 
-static inline bool is_huge_zero_pud(pud_t pud)
-{
-       return false;
-}
-
 static inline void mm_put_huge_zero_folio(struct mm_struct *mm)
 {
        return;
index cc2872f12030466d158495fe4b75e089568edf0c..a4a14b81e013ebfcf390060579c2b50d19a4c56b 100644 (file)
@@ -1453,10 +1453,8 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,
        ptl = pud_lock(mm, pud);
        if (!pud_none(*pud)) {
                if (write) {
-                       if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) {
-                               WARN_ON_ONCE(!is_huge_zero_pud(*pud));
+                       if (WARN_ON_ONCE(pud_pfn(*pud) != pfn_t_to_pfn(pfn)))
                                goto out_unlock;
-                       }
                        entry = pud_mkyoung(*pud);
                        entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma);
                        if (pudp_set_access_flags(vma, addr, pud, entry, 1))
@@ -1704,15 +1702,6 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
        if (unlikely(!pud_trans_huge(pud) && !pud_devmap(pud)))
                goto out_unlock;
 
-       /*
-        * When page table lock is held, the huge zero pud should not be
-        * under splitting since we don't split the page itself, only pud to
-        * a page table.
-        */
-       if (is_huge_zero_pud(pud)) {
-               /* No huge zero pud yet */
-       }
-
        /*
         * TODO: once we support anonymous pages, use
         * folio_try_dup_anon_rmap_*() and split if duplicating fails.