]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/memory: split non-tlb flushing part from zap_page_range_single()
authorSeongJae Park <sj@kernel.org>
Thu, 10 Apr 2025 00:00:21 +0000 (17:00 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:27 +0000 (17:48 -0700)
commitde8efdf8cd273619121cbc2f0f70dddc74bc586e
tree2b998aa57d52bc9b90fd00f34d3e71c6932ddc78
parent01bef02bf9301ea6c255b0daa38356e07719dd69
mm/memory: split non-tlb flushing part from zap_page_range_single()

Some of zap_page_range_single() callers such as [process_]madvise() with
MADV_DONTNEED[_LOCKED] cannot batch tlb flushes because
zap_page_range_single() flushes tlb for each invocation.  Split out the
body of zap_page_range_single() except mmu_gather object initialization
and gathered tlb entries flushing for such batched tlb flushing usage.

To avoid hugetlb pages allocation failures from concurrent page faults,
the tlb flush should be done before hugetlb faults unlocking, though.  Do
the flush and the unlock inside the split out function in the order for
hugetlb vma case.  Refer to commit 2820b0f09be9 ("hugetlbfs: close race
between MADV_DONTNEED and page fault") for more details about the
concurrent faults' page allocation failure problem.

Link: https://lkml.kernel.org/r/20250410000022.1901-4-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory.c