[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgRu33083QOSES=MUO-SBfLHjV2Zwq7OxorL+wXwHNw6Q@mail.gmail.com>
Date: Wed, 16 Nov 2022 09:39:49 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Alexander Gordeev <agordeev@...ux.ibm.com>
Cc: Hugh Dickins <hughd@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Nadav Amit <nadav.amit@...il.com>,
Will Deacon <will@...nel.org>,
Aneesh Kumar <aneesh.kumar@...ux.ibm.com>,
Nick Piggin <npiggin@...il.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>
Subject: Re: [PATCH 4/4] mm: delay page_remove_rmap() until after the TLB has
been flushed
On Tue, Nov 15, 2022 at 11:48 PM Alexander Gordeev
<agordeev@...ux.ibm.com> wrote:
>
> Which actually brings a question whether CONFIG_MMU_GATHER_NO_GATHER
> mode could be beneficial for UP?
No, the NO_GATHER case wouldn't work for UP in general, because once
we drop the page table lock, even on UP we end up possibly
re-scheduling due to preemption (and even without actual kernel
preemption, we have that explicit "cond_resched()" there).
And if we schedule to another thread that shares the same VM, that
other thread will continue to use the existing TLB entries.
And if those TLB entries then point to pages that were already free'd...
So the NO_GATHER case requires that you flush the TLB early even on
UP, although the requirements are a _bit_ less strict than on SMP.
And TLB flushes are not necessarily cheap, even on UP.
Now, we could possibly optimize this to the point where it *would* be
quite possible - instead of actually flushing the TLB, just set the
bit to "flush on next thread switch". So I think the UP case *could*
be made to be non-gathering.
But I don't think anybody cares about - or tests - UP enough for it to
make sense to worry about it.
Linus
Powered by blists - more mailing lists