Re: [RFC v2 PATCH 0/16] Optimize this_cpu_*() ops for non-x86 (ARM64 for this series)

Heiko Carstens <[email protected]> Wed, 5 Aug 2026 10:45:03 +0200
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm,gmane.linux.ports.arm.kernel
Message-ID <[email protected]>
On Tue, Aug 04, 2026 at 11:47:03PM +0200, David Hildenbrand (Arm) wrote:
> On 8/4/26 23:25, Christoph Lameter (Ampere) wrote:
> > On Tue, 4 Aug 2026, David Hildenbrand (Arm) wrote:
> >> Mark's solution is the obvious improvement to the problem, doing it just like
> >> s390 already does.
> > 
> > Well there is interest by the S390 folks to move to what we proposed from
> > what I can tell.
> 
> Heiko said that as reply to v1, bit he's been replying a lot on Mark's patches.
> Only Heiko can tell. (on CC)

I said that before Peter Zijlstra proposed the restartable sequence approach
for the kernel. I took that as input, and provided the current solution for
s390, which does not restart anything, but only fix up register contents if
required. Now Mark provided an improved implementation for arm64.

That said, there are some performance numbers [1] for s390 available as posted
by Mete. A performance improvement is indeed there, but looking at the current
s390 implementation I'm not sure there will be much of a benefit if we now go
to percpu page tables.

Currently we have this code sequence for e.g. this_cpu_add(...)
(%r2 contains the to be added value).

larl    %r4,1b33300     <-- load address of percpu var
mviy    960,4           <-- mark start of percpu op section
ag      %r4,952         <-- add percpu offset
laag    %r5,%r2,0(%r4)  <-- atomic add
mviy    960,0           <-- mark end of percpu op section

With the proposed percpu page tables I would guess / hope we would end up with
something like this:

larl    %r4,1b33300     <-- load address of percpu var (same on all cpus)
laag    %r5,%r2,0(%r4)  <-- atomic add

That's certainly better to what we have compared to now (no performance
numbers available), but I'm not sure if only this would justify all the
added complexity to common code currently discussed.

Read: I'm more or less fine with the current s390 solution, and not pushing
      for percpu page tables.

[1] https://lore.kernel.org/all/[email protected]/