]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/huge_memory: use mm instead of tlb->mm
authorLorenzo Stoakes (Oracle) <ljs@kernel.org>
Fri, 20 Mar 2026 18:07:26 +0000 (18:07 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:46 +0000 (13:53 -0700)
Reduce the repetition, and lay the ground for further refactorings by
keeping this variable separate.

Link: https://lkml.kernel.org/r/98104cde87e4b2aabeb16f236b8731591594457f.1774029655.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nico Pache <npache@redhat.com>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/huge_memory.c

index d7c1c8f55c1365d8d5b6055698692c89d80b3d1b..c515e293ed48283f51037baf878bc6c91c8b56ba 100644 (file)
@@ -2415,6 +2415,7 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
                 pmd_t *pmd, unsigned long addr)
 {
        bool has_deposit = arch_needs_pgtable_deposit();
+       struct mm_struct *mm = tlb->mm;
        struct folio *folio = NULL;
        bool flush_needed = false;
        spinlock_t *ptl;
@@ -2462,9 +2463,9 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
 
        if (folio_test_anon(folio)) {
                has_deposit = true;
-               add_mm_counter(tlb->mm, MM_ANONPAGES, -HPAGE_PMD_NR);
+               add_mm_counter(mm, MM_ANONPAGES, -HPAGE_PMD_NR);
        } else {
-               add_mm_counter(tlb->mm, mm_counter_file(folio),
+               add_mm_counter(mm, mm_counter_file(folio),
                               -HPAGE_PMD_NR);
 
                /*
@@ -2483,7 +2484,7 @@ bool zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
 
 out:
        if (has_deposit)
-               zap_deposited_table(tlb->mm, pmd);
+               zap_deposited_table(mm, pmd);
 
        spin_unlock(ptl);
        if (flush_needed)