[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <61e3ea6a-368a-640f-a050-b56c8d3232b5@google.com>
Date: Mon, 27 Jan 2025 12:55:11 -0800 (PST)
From: Hugh Dickins <hughd@...gle.com>
To: Roman Gushchin <roman.gushchin@...ux.dev>
cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>, Jann Horn <jannh@...gle.com>,
Peter Zijlstra <peterz@...radead.org>, Will Deacon <will@...nel.org>,
"Aneesh Kumar K.V" <aneesh.kumar@...nel.org>,
Nick Piggin <npiggin@...il.com>, Hugh Dickins <hughd@...gle.com>,
linux-arch@...r.kernel.org
Subject: Re: [PATCH v4] mmu_gather: move tlb flush for VM_PFNMAP/VM_MIXEDMAP
vmas into free_pgtables()
On Mon, 27 Jan 2025, Roman Gushchin wrote:
> Commit b67fbebd4cf9 ("mmu_gather: Force tlb-flush VM_PFNMAP vmas")
> added a forced tlbflush to tlb_vma_end(), which is required to avoid a
> race between munmap() and unmap_mapping_range(). However it added some
> overhead to other paths where tlb_vma_end() is used, but vmas are not
> removed, e.g. madvise(MADV_DONTNEED).
>
> Fix this by moving the tlb flush out of tlb_end_vma() into
> free_pgtables(), somewhat similar to the stable version of the
> original commit: e.g. stable commit 895428ee124a ("mm: Force TLB flush
> for PFNMAP mappings before unlink_file_vma()").
>
> Note, that if tlb->fullmm is set, no flush is required, as the whole
> mm is about to be destroyed.
>
> Signed-off-by: Roman Gushchin <roman.gushchin@...ux.dev>
> Cc: Jann Horn <jannh@...gle.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Will Deacon <will@...nel.org>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@...nel.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Nick Piggin <npiggin@...il.com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: linux-arch@...r.kernel.org
> Cc: linux-mm@...ck.org
>
> ---
>
> v4:
> - naming/comments update (by Peter Z.)
> - check vma->vma->vm_flags in tlb_free_vma() (by Peter Z.)
Let me just put on record: you were absolutely right not to extend to
this the Ack I gave to v3, this v4 is silly (tlb_free_vma() and its
multiple calls, necessary only because of the unnecessary extra test);
but I don't see it as doing any actual damage, so I'll stop short of
NAKking it.
Hugh
Powered by blists - more mailing lists