[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bc489455-bb18-44dc-8518-ae75abda6bec@kernel.org>
Date: Thu, 5 Feb 2026 23:49:48 +0100
From: "David Hildenbrand (Arm)" <david@...nel.org>
To: Dave Hansen <dave.hansen@...el.com>, Matthew Wilcox
<willy@...radead.org>, Lance Yang <lance.yang@...ux.dev>
Cc: Peter Zijlstra <peterz@...radead.org>, Liam.Howlett@...cle.com,
akpm@...ux-foundation.org, aneesh.kumar@...nel.org, arnd@...db.de,
baohua@...nel.org, baolin.wang@...ux.alibaba.com,
boris.ostrovsky@...cle.com, bp@...en8.de, dave.hansen@...ux.intel.com,
dev.jain@....com, hpa@...or.com, hughd@...gle.com, ioworker0@...il.com,
jannh@...gle.com, jgross@...e.com, kvm@...r.kernel.org,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, lorenzo.stoakes@...cle.com, mingo@...hat.com,
npache@...hat.com, npiggin@...il.com, pbonzini@...hat.com, riel@...riel.com,
ryan.roberts@....com, seanjc@...gle.com, shy828301@...il.com,
tglx@...utronix.de, virtualization@...ts.linux.dev, will@...nel.org,
x86@...nel.org, ypodemsk@...hat.com, ziy@...dia.com
Subject: Re: [PATCH v4 0/3] targeted TLB sync IPIs for lockless page table
On 2/5/26 19:36, Dave Hansen wrote:
> On 2/5/26 09:06, David Hildenbrand (Arm) wrote:
>>> But can't we RCU-free the page table? Why do we need to wait for the
>>> RCU readers to finish?
>>
>> For unsharing hugetlb PMD tables the problem is not the freeing but the
>> reuse of the PMD table for other purposes in the last remaining user.
>> It's complicated.
>
> Letting the previously-shared table get released to everything else in
> the system sounds like a fixable problem. tlb_flush_unshared_tables()
> talks about this, and it makes sense that once locks get dropped that
> something else could get mapped in and start using the PMD.
Yeah, I tried to document that carefully.
>
> The RCU way of fixing that would be to allocate new page table, replace
> the old one, and RCU-free the old one. Read, Copy, Update. :)
>
> It does temporarily eat up an extra page, and cost an extra copy. But
> neither of those seems expensive compared to IPI'ing the world.
I played with many such ideas, including never reusing a page table
again once it was once shared. All turned out rather horrible.
RCU-way: replacing a shared page table involves updating all processes
that share the page table :/ . I think another issue I stumbled into
while trying to implement was around failing to allocate memory (but
being required to make progress). It all turned to quite some complexity
and inefficiency, so I had to give up on that. :)
>
>> For page table freeing, we only do it if we fail to allocate memory --
>> if we cannot use RCU IIRC.
>
> But that case is fine to be slow and use synchronize_rcu(). If you're
> failing to allocate a single page, you're in a way slow path anyway.
That's true. We could likely do that already and avoid the IPI broadcast
there that was once reported to be a problem for RT applications.
--
Cheers,
David
Powered by blists - more mailing lists