[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da1e8a00-99fe-46d9-b425-c307ea933036@kernel.org>
Date: Tue, 6 Jan 2026 16:19:10 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: Lance Yang <lance.yang@...ux.dev>, akpm@...ux-foundation.org
Cc: dave.hansen@...el.com, dave.hansen@...ux.intel.com, will@...nel.org,
aneesh.kumar@...nel.org, npiggin@...il.com, peterz@...radead.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
hpa@...or.com, arnd@...db.de, lorenzo.stoakes@...cle.com, ziy@...dia.com,
baolin.wang@...ux.alibaba.com, Liam.Howlett@...cle.com, npache@...hat.com,
ryan.roberts@....com, dev.jain@....com, baohua@...nel.org,
shy828301@...il.com, riel@...riel.com, jannh@...gle.com,
linux-arch@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, ioworker0@...il.com
Subject: Re: [PATCH RESEND v3 1/2] mm/tlb: skip redundant IPI when TLB flush
already synchronized
>
> static void tlb_table_flush(struct mmu_gather *tlb)
> @@ -367,7 +378,7 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table)
> *batch = (struct mmu_table_batch *)__get_free_page(GFP_NOWAIT);
> if (*batch == NULL) {
> tlb_table_invalidate(tlb);
> - tlb_remove_table_one(table);
> + tlb_remove_table_one(table, tlb);
> return;
> }
> (*batch)->nr = 0;
> @@ -427,6 +438,7 @@ static void __tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm,
> tlb->vma_pfn = 0;
>
> tlb->fully_unshared_tables = 0;
> + tlb->tlb_flush_sent_ipi = 0;
> __tlb_reset_range(tlb);
> inc_tlb_flush_pending(tlb->mm);
> }
But when would we have to reset tlb->tlb_flush_sent_ipi = 0 later?
That's where it gets tricky. Just imagine the MMU gather gets reused later.
Also,
+ if (info->freed_tables && info->tlb)
+ info->tlb->tlb_flush_sent_ipi = true;
in native_flush_tlb_multi() misses the fact that we have different
flushing types for removed/unshared tables vs. other flush.
So this approach more here certainly gets more complicated and error prone.
tlb_table_flush_implies_ipi_broadcast() was clearer in that regard: if
you flushed the TLB after removing /unsharing tables, the IPI for
handling page tables can be skipped. It's on the code flow to assure that.
What could work is tracking "tlb_table_flush_sent_ipi" really when we
are flushing the TLB for removed/unshared tables, and maybe resetting it
... I don't know when from the top of my head.
v2 was simpler IMHO.
--
Cheers
David
Powered by blists - more mailing lists