Re: [PATCH v1 4/4] mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather
From: David Hildenbrand (Red Hat)
Date: Thu Dec 18 2025 - 07:52:59 EST
Isn't really the correct comment here that ranges that previously mapped the
shared pages might no longer, so we must clear the TLB? I may be missing
something :)
There are cases where we defer flushing the TLB until we dropped all (exclusive) locks.
In particular, MADV_DONTNEED does that in some cases, essentially deferring the flush
to the tlb_finish_mmu().
free_pgtables() will also defer the flush, performing the TLB flush during tlb_finish_mmu(),
before
The point is (as I tried to make clear in the comment), for unsharing we have no control
whenn the page table gets freed after we drop the lock.
So we must flush the TLB now and cannot defer it like we do in the other cases.
Yeah I guess because of the above - that is - other users may unshare for their
CPUs but not unshare for ours?
Yes :)
It's all very complicated, therefore I decided to rather add more
comments describing what we depend on.
--
Cheers
David