From: "Christoph Lameter (Ampere)" <cl@gentwo.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
"David Hildenbrand (Arm)" <david@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Yang Shi <yang@os.amperecomputing.com>,
Ryan Roberts <ryan.roberts@arm.com>,
dennis@kernel.org, tj@kernel.org, urezki@gmail.com,
catalin.marinas@arm.com, will@kernel.org,
akpm@linux-foundation.org, hca@linux.ibm.com, gor@linux.ibm.com,
agordeev@linux.ibm.com, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [RFC v2 PATCH 0/16] Optimize this_cpu_*() ops for non-x86 (ARM64 for this series)
Date: Tue, 4 Aug 2026 09:15:55 -0700 (PDT) [thread overview]
Message-ID: <dadd8268-3cef-3a3a-e277-b593bef3b788@gentwo.org> (raw)
In-Reply-To: <CAHk-=wgJ0wO=T+1G5zJwoeE-N4bAptCNo2TFirK364iPhnGG6A@mail.gmail.com>
On Tue, 4 Aug 2026, Linus Torvalds wrote:
> On Tue, 4 Aug 2026 at 07:15, Lorenzo Stoakes (ARM) <ljs@kernel.org> wrote:
> >
> > Linus - I assume you still find per-cpu page tables totally unacceptable? (had a
> > look around to see your take on this recently and found [0] which seems to
> > confirm it :)
>
> Yes, I still think that per-cpu page tables as some kind of
> architectural design is a horrible idea, because it paints us into a
> corner where you have intentional duplication and then end up having
> to have coherency issues where you need to lock for updates just to
> keep things in sync - and may need to do extra work on hardware that
> may otherwise already have hardware coherency support.
We already have had the intentional duplication, meaning multiple
virtual addresses for a single physical address with vmalloc and with
vmemmap for a very long time. Issues with hardware coherency that may have
existed for these cases have been fixed a long time ago.
> I honestly think that people who think that cache coherency in
> software is a great idea in general are misguided and should not work
> on kernels, but should go back to eating crayons and decide if purple
> tastes better than yellow.
Certain a bad idea. The per cpu pagew tables do not rely on cache
coherency in software.
> That said - per-cpu page tables as some kind of internal architecture
> choice that limits the damage to some simpler case is not necessarily
> wrong. We've obviously done things like that for page table isolation
> etc. It can be horribly expensive, but sometimes that is the price you
> are willing to pay - and sometimes you can avoid the expense entirely
> by knowing how the particular hardware works.
Have the same virtual address on all processors to reach the local per cpu
instance of a variable simplifies kernel code and avoids
preempt_enable/disable sections. Especially operations on counters in the
VM become much more efficient.
X86 can accomplish that with a segment override. That is not available on
other platforms. Page tables can be used to do the proper mapping so that
kernel code does not have to theses address calculations. These are
frequent operations in the kernel memory management.
> Very specific example: on 32-bit x86 with PAE, the top-level page
> table directory is fundamentally per-cpu in nature. It's just four
> entries that get loaded into the CPU on page table load, but it means
> that you can do things like having one quarter of the page tables be
> per-cpu, and the rest be shared. Several other architectures have
> similar "regions". So it can be an architectural choice to have some
> kind of per-cpu TLB. But I absolutely do *not* want to see a model
> where the general MM layer dictates that design.
X86 creates highly optimized code for per cpu operations without preempt
enable/disable sections and I hope its ok to use per cpu page table to get
to a similar degress of compactness and performance on ARM64.
> And there are historical reasons to really hate it. Plan-9 had a
> completely broken threading model that depended on per-thread page
> tables. It was literal garbage. It was broken beyond words exactly due
> to coherency issues, and I still do not understand how otherwise very
> smart people ever came up with such a stupid idea.
>
> We are not making _that_ mistake. We have made enough other ones to
> not neet to shoot ourselves in the head that badly.
We certainly do not want to replicate that approach. We are using the per
cpu page tables to avoid address calculations in the VM that other
platforms can do with a segment override.
next prev parent reply other threads:[~2026-08-04 16:27 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 18:04 [RFC v2 PATCH 0/16] Optimize this_cpu_*() ops for non-x86 (ARM64 for this series) Yang Shi
2026-07-15 18:04 ` [PATCH 01/16] drivers: arch_numa: move percpu set up code to arch Yang Shi
2026-07-15 18:04 ` [PATCH 02/16] arm64: kconfig: make percpu related configs not depend on NUMA Yang Shi
2026-07-15 18:04 ` [PATCH 03/16] mm: pgalloc: introduce {pud|pmd}_populate_sync() Yang Shi
2026-07-15 18:04 ` [PATCH 04/16] vmalloc: pass in pgd pointer for vmap{__vunmap}_range_noflush() Yang Shi
2026-07-29 9:32 ` Lorenzo Stoakes (ARM)
2026-08-03 19:12 ` Yang Shi
2026-08-04 13:47 ` Lorenzo Stoakes (ARM)
2026-07-15 18:04 ` [PATCH 05/16] arm64: mm: enable percpu kernel page table Yang Shi
2026-07-15 18:04 ` [PATCH 06/16] arm64: mm: defined {pud|pmd}_populate_sync() Yang Shi
2026-07-15 18:04 ` [PATCH 07/16] arm64: mm: sync percpu page table for memory hotplug/unplug Yang Shi
2026-07-15 18:04 ` [PATCH 08/16] arm64: kasan: sync up kasan shadow area page table Yang Shi
2026-07-15 18:04 ` [PATCH 09/16] arm64: mm: define percpu virtual space area Yang Shi
2026-07-15 18:04 ` [PATCH 10/16] mm: percpu: prepare to use dedicated percpu area Yang Shi
2026-07-15 18:04 ` [PATCH 11/16] arm64: mm: map local percpu first chunk Yang Shi
2026-07-15 18:04 ` [PATCH 12/16] mm: percpu: set up first chunk and reserve chunk Yang Shi
2026-07-15 18:04 ` [PATCH 13/16] arm64: mm: introduce __per_cpu_local_off Yang Shi
2026-07-15 18:04 ` [PATCH 14/16] mm: percpu: allocate and free local percpu vm area Yang Shi
2026-07-15 18:04 ` [PATCH 15/16] arm64: kconfig: select HAVE_LOCAL_PER_CPU_MAP Yang Shi
2026-07-15 18:04 ` [PATCH 16/16] arm64: percpu: use local percpu for this_cpu_*() APIs Yang Shi
2026-07-16 13:23 ` [RFC v2 PATCH 0/16] Optimize this_cpu_*() ops for non-x86 (ARM64 for this series) Ryan Roberts
2026-07-21 19:08 ` Mark Rutland
2026-07-21 23:20 ` Yang Shi
2026-07-22 9:36 ` Mark Rutland
2026-07-27 21:10 ` Yang Shi
2026-07-27 22:06 ` Christoph Lameter (Ampere)
2026-07-29 9:28 ` David Hildenbrand (Arm)
2026-08-04 14:15 ` Lorenzo Stoakes (ARM)
2026-08-04 14:21 ` Lorenzo Stoakes (ARM)
2026-08-04 14:40 ` Jason Gunthorpe
2026-08-04 18:06 ` Matthew Wilcox
2026-08-04 18:16 ` Jason Gunthorpe
2026-08-04 15:21 ` Linus Torvalds
2026-08-04 16:15 ` Christoph Lameter (Ampere) [this message]
2026-08-04 16:30 ` Linus Torvalds
2026-08-04 16:54 ` David Hildenbrand (Arm)
2026-08-04 17:01 ` Linus Torvalds
2026-08-04 17:32 ` Lorenzo Stoakes (ARM)
2026-08-04 21:40 ` Christoph Lameter (Ampere)
2026-08-04 21:48 ` David Hildenbrand (Arm)
2026-08-04 21:56 ` Christoph Lameter (Ampere)
2026-08-04 22:01 ` David Hildenbrand (Arm)
2026-08-05 8:16 ` Lorenzo Stoakes (ARM)
2026-08-04 17:23 ` Lorenzo Stoakes (ARM)
2026-08-04 17:28 ` Linus Torvalds
2026-08-04 21:51 ` Yang Shi
2026-08-04 22:05 ` David Hildenbrand (Arm)
2026-08-04 22:35 ` Christoph Lameter (Ampere)
2026-08-05 6:11 ` David Hildenbrand (Arm)
2026-08-05 14:48 ` Mark Rutland
2026-08-05 7:52 ` Lorenzo Stoakes (ARM)
2026-08-06 17:15 ` Will Deacon
2026-08-06 17:31 ` Lorenzo Stoakes (ARM)
2026-08-04 16:19 ` Christoph Lameter (Ampere)
2026-08-04 16:47 ` David Hildenbrand (Arm)
2026-08-04 21:25 ` Christoph Lameter (Ampere)
2026-08-04 21:47 ` David Hildenbrand (Arm)
2026-08-04 22:01 ` Christoph Lameter (Ampere)
2026-08-05 6:12 ` David Hildenbrand (Arm)
2026-08-05 8:45 ` Heiko Carstens
2026-08-05 11:10 ` David Laight
2026-08-05 14:53 ` Mark Rutland
2026-07-30 6:06 ` [RFC v2 PATCH 0/16] Optimize this_cpu_*() ops for non-x86 (ARM64 for this series)~ Mete Durlu
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=dadd8268-3cef-3a3a-e277-b593bef3b788@gentwo.org \
--to=cl@gentwo.org \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=dennis@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jgg@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mark.rutland@arm.com \
--cc=ryan.roberts@arm.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=urezki@gmail.com \
--cc=will@kernel.org \
--cc=yang@os.amperecomputing.com \
/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