Re: [PATCH 2/4] s390/percpu: Drop unused output register from arch_this_cpu_add()
From: Heiko Carstens
Date: Mon Oct 12 2026 - 10:30:50 EST
On Mon, Oct 12, 2026 at 03:24:20PM +0200, Alexander Gordeev wrote:
> On Mon, Oct 12, 2026 at 01:42:47PM +0200, Heiko Carstens wrote:
> > The laa/laag instructions return the old memory content, but
> > arch_this_cpu_add() does not need it. Instead of allocating a dedicated
> > output register old__ just to discard the returned value, change the
> > val__ constraint from "d" to "+&d" so it is used as input/output
> > register.
> >
> > This reduces register pressure.
>
> Do you know whether the compiler is may be smart enough to select the
> same register for old and val himself?
In theory, if the constraints would allow that, yes. But for the preemptible
percpu inline asm all output operands need to be early clobbered. Therefore
gcc is forced to not do that.
> My concern is if we force the compiler to do so we might lose optimiztions
> where the val could be reused after the op.
The overall size change of the kernel image is six bytes :).
I guess we shouldn't spend too much time with this.