From: Lorenzo Stoakes (Oracle) Date: Fri, 20 Mar 2026 18:07:26 +0000 (+0000) Subject: mm/huge_memory: use mm instead of tlb->mm X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c6b7ff60bd477bb73b737e2955c0ad49cffd7ca;p=thirdparty%2Fkernel%2Flinux.git mm/huge_memory: use mm instead of tlb->mm 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) Reviewed-by: Baolin Wang Reviewed-by: Suren Baghdasaryan Cc: Barry Song Cc: David Hildenbrand Cc: Dev Jain Cc: Lance Yang Cc: Liam Howlett Cc: Michal Hocko Cc: Mike Rapoport Cc: Nico Pache Cc: Qi Zheng Cc: Ryan Roberts Cc: Zi Yan Signed-off-by: Andrew Morton --- diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d7c1c8f55c136..c515e293ed482 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -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)