From: David Woodhouse <dwmw2@infradead.org>
To: paulmck@kernel.org
Cc: "Sean Christopherson" <seanjc@google.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Michal Hocko" <mhocko@suse.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand" <david@kernel.org>,
"Lorenzo Stoakes" <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Clark Williams" <clrkwllms@kernel.org>,
"Simona Vetter" <simona.vetter@ffwll.ch>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Christian König" <christian.koenig@amd.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
linux-mm@kvack.org, kvm@vger.kernel.org,
linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation
Date: Wed, 12 Aug 2026 22:55:33 +0100 [thread overview]
Message-ID: <b5f16da93f87dcb53414e27f2b1c647a3378fb48.camel@infradead.org> (raw)
In-Reply-To: <b736237c-64ee-4eb2-8201-5685a3853844@paulmck-laptop>
[-- Attachment #1: Type: text/plain, Size: 7575 bytes --]
On Wed, 2026-08-12 at 14:38 -0700, Paul E. McKenney wrote:
> On Wed, Aug 12, 2026 at 06:17:50PM +0100, David Woodhouse wrote:
> > On 12 August 2026 17:20:51 BST, Sean Christopherson <seanjc@google.com> wrote:
> > > On Wed, Aug 12, 2026, David Woodhouse wrote:
> > > > On Wed, 2026-08-12 at 16:03 +0100, David Woodhouse wrote:
> > > > > On Wed, 2026-08-12 at 15:34 +0100, David Woodhouse wrote:
> > > > > > On Wed, 2026-08-12 at 15:05 +0100, David Woodhouse wrote:
> > > > > > > I'll rephrase that for my own understanding:
> > > > > > >
> > > > > > > *If* we go all the way to building a whole SRCU flavour for this *and*
> > > > > > > implementing a spin-only variant of srcu_synchronize() which is
> > > > > > > tailored to the atomic-reader use case, *then* we don't need to remove
> > > > > > > the non_block_{start,end} guards around the MMU notifiers, which are
> > > > > > > basically never being called anyway and don't actually seem to protect
> > > > > > > against any real bugs.
> > > > > > >
> > > > > > > Yes?
> > > > > >
> > > > > > FWIW it looks something like this. I'll throw it into my torture and
> > > > > > latency tests, and we can see what Paul thinks of it. I'm still utterly
> > > > > > unconvinced it's needed, but I concede it has its good points.
> > > > >
> > > > > This slightly refactored version is the one that's actually going into
> > > > > my torture tests...
> > > >
> > > > Well, it survived first contact, and it's doing the soak testing now.
> > > >
> > > > The average is basically no better than the try_synchronize_srcu()
> > > > case, unsurprisingly — as *both* of them just observe that there are no
> > > > readers and proceed immediately, in at least 99% of cases.
> > > >
> > > > Like the existing rwlock case, it still manages double-digit p100
> > > > latency even when though *doesn't* actually sleep.
> > > >
> > > > I don't *hate* it, but I do question the benefit of it over try-first.
> > >
> > > FWIW, the max latency and >8ms numbers are very appealing to me, as my concerns
> > > with using SRCU are all about the tail latencies.
> > >
> > > But I'm obviously not the one who'd be saddled with maintaining the code, so I'm
> > > more than a little biased towards choosing the more complex version.
> >
> > Ack. Well, it isn't even *that* bad in terms of complexity. It's
> > mostly just a while loop around the core of the
> > try_synchronize_srcu() I posted before, and some syntactic sugar
> > and safeguards.
> >
> > Let's see what Paul thinks.
>
> A single call to try_synchronize_srcu() that, upon failure, invokes
> synchronize_srcu_expedited() would work fine. And a limited loop on
> try_synchronize_srcu() that invokes synchronize_srcu_expedited() upon
> repeated failure return would also work fine.
>
> But if you had a large system, an unlimited loop on try_synchronize_srcu()
> could wait forever on a system that was large enough that there was at
> least one reader at all times. To guarantee loop termination, it is
> necessary to flip the index. That way, new readers would use the index
> that was already seen to be clear, and old readers would eventually
> drain from the old index.
Right. The 'while loop around try_synchronize_srcu()' as I described it
above was playing on my mind a little as I was out hunting the solar
eclipse this evening, and you *just* beat me to pointing it out.
> So is your use case adddressed by the single call to
> try_synchronize_srcu() that, upon failure, invokes
> synchronize_srcu_expedited()? If so, we have a solution!
I was angling for that... but given Sean's latest response above, I
don't think I was winning :)
Even if it wasn't a single call, but spin for a while before falling
back, that still doesn't address Sean's concern about the tail
latencies.
> If not, please let me know, and I will put together that does the job.
I think it would be good to take a look at that option, yes please if
it's a reasonable thing to do.
> Thanx, Paul
>
> > > > Again, I'll defer to Paul, but personally I'd want to see a more
> > > > compelling use case for it.
> > > >
> > > > ┌───────────────┬─────────────────────┬───────────────────┬─────────────────────┐
> > > > │ │ expedited │ try-first │ atomic │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ median drain │ 32-128µs │ 4-16µs │ 4-16µs │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ avg │ 118µs │ 13.8µs │ 12.3µs │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ >1ms │ ~950ppm │ ~990ppm │ 838ppm │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ >8ms │ 42ppm │ 4.4ppm │ 0.10ppm │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ max │ 33.6ms │ 17.6ms │ 10.25ms │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ fallback rate │ — │ 1.2% │ 0% │
> > > > ├───────────────┼─────────────────────┼───────────────────┼─────────────────────┤
> > > > │ sample │ 32.6M drains, 10min │ 41M drains, 10min │ 40.5M drains, 10min │
> > > > └───────────────┴─────────────────────┴───────────────────┴─────────────────────┘
> >
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6179 bytes --]
next prev parent reply other threads:[~2026-08-12 21:55 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 8:58 [PATCH] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation David Woodhouse
2026-08-11 13:55 ` Jason Gunthorpe
2026-08-11 14:21 ` David Woodhouse
2026-08-11 14:27 ` Jason Gunthorpe
2026-08-11 14:33 ` David Woodhouse
2026-08-11 14:42 ` Steven Rostedt
2026-08-11 15:24 ` David Woodhouse
2026-08-11 15:30 ` Jason Gunthorpe
2026-08-12 8:14 ` Michal Hocko
2026-08-12 8:21 ` David Woodhouse
2026-08-12 12:27 ` Jason Gunthorpe
2026-08-12 13:46 ` David Woodhouse
2026-08-12 13:49 ` Jason Gunthorpe
2026-08-12 14:05 ` David Woodhouse
2026-08-12 14:26 ` Jason Gunthorpe
2026-08-12 14:38 ` David Woodhouse
2026-08-13 10:05 ` David Woodhouse
2026-08-13 13:59 ` Sean Christopherson
2026-08-13 14:40 ` Jason Gunthorpe
2026-08-12 14:34 ` David Woodhouse
2026-08-12 15:03 ` David Woodhouse
2026-08-12 15:49 ` David Woodhouse
2026-08-12 16:20 ` Sean Christopherson
2026-08-12 17:17 ` David Woodhouse
2026-08-12 21:38 ` Paul E. McKenney
2026-08-12 21:55 ` David Woodhouse [this message]
2026-08-13 7:54 ` David Woodhouse
2026-08-18 18:18 ` Paul E. McKenney
2026-08-18 18:28 ` David Woodhouse
2026-08-20 14:43 ` David Woodhouse
2026-08-21 17:38 ` Paul E. McKenney
2026-08-25 12:15 ` David Woodhouse
2026-08-25 16:47 ` Paul E. McKenney
2026-08-25 17:05 ` David Woodhouse
2026-08-25 17:19 ` Paul E. McKenney
2026-08-25 17:48 ` David Woodhouse
2026-08-25 18:16 ` Paul E. McKenney
2026-08-25 19:58 ` Sean Christopherson
2026-08-25 20:51 ` Paul E. McKenney
2026-08-26 7:32 ` Sebastian Andrzej Siewior
2026-08-26 7:38 ` David Woodhouse
2026-08-26 15:05 ` Paul E. McKenney
2026-08-26 16:28 ` Paul E. McKenney
2026-08-26 18:01 ` David Woodhouse
2026-08-26 19:59 ` Paul E. McKenney
2026-08-26 20:30 ` David Woodhouse
2026-08-26 21:04 ` Paul E. McKenney
2026-08-27 8:20 ` Sebastian Andrzej Siewior
2026-08-27 23:25 ` David Woodhouse
2026-08-28 23:18 ` David Woodhouse
2026-09-01 0:58 ` Paul E. McKenney
2026-09-01 9:40 ` David Woodhouse
2026-09-01 19:12 ` Sean Christopherson
2026-09-01 20:40 ` Paul E. McKenney
2026-09-01 22:51 ` Sean Christopherson
2026-09-01 22:53 ` David Woodhouse
2026-09-01 23:05 ` Paul E. McKenney
2026-08-12 16:04 ` Paolo Bonzini
2026-08-12 16:07 ` Jason Gunthorpe
2026-08-12 17:49 ` David Woodhouse
2026-08-20 13:30 ` Sebastian Andrzej Siewior
2026-08-20 14:26 ` David Woodhouse
2026-08-20 15:34 ` Sebastian Andrzej Siewior
2026-08-20 18:49 ` David Woodhouse
2026-08-12 8:13 ` Michal Hocko
2026-08-11 15:29 ` Jason Gunthorpe
2026-08-11 15:15 ` David Woodhouse
2026-08-11 15:24 ` Jason Gunthorpe
2026-08-11 15:29 ` David Woodhouse
2026-08-11 16:24 ` Jason Gunthorpe
2026-08-11 17:22 ` David Woodhouse
2026-08-11 17:26 ` Jason Gunthorpe
2026-08-11 17:59 ` David Woodhouse
2026-08-11 18:19 ` Jason Gunthorpe
2026-08-11 20:06 ` Sean Christopherson
2026-08-11 20:21 ` Paolo Bonzini
2026-08-11 21:14 ` David Woodhouse
2026-08-11 22:58 ` Sean Christopherson
2026-08-11 23:50 ` David Woodhouse
2026-08-12 10:25 ` David Woodhouse
2026-08-12 16:07 ` Sean Christopherson
2026-08-11 20:29 ` David Woodhouse
2026-08-11 15:12 ` David Hildenbrand (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b5f16da93f87dcb53414e27f2b1c647a3378fb48.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=christian.koenig@amd.com \
--cc=clrkwllms@kernel.org \
--cc=david@kernel.org \
--cc=jgg@ziepe.ca \
--cc=jglisse@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=seanjc@google.com \
--cc=simona.vetter@ffwll.ch \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).