Re: [PATCH v1 1/1] x86/percpu: Cast -1 to argument type when comparing in percpu_add_op()

H. Peter Anvin
2024-10-23T21:41:53Z

On 10/23/24 10:15, Dave Hansen wrote:
> On 10/22/24 16:24, Christoph Lameter (Ampere) wrote:
>> On Tue, 22 Oct 2024, Dave Hansen wrote:
>>
>>> So I think Peter's version was the best. It shuts up clang and also
>>> preserves the existing (good) gcc 'sub' behavior. I'll send it out for
>>> real in a bit, but I'm thinking of something like the attached patch.
>> The desired behavior is a "dec". "sub" has a longer op code AFAICT.
>
> Gah, yes, of course. I misspoke.
>
> We want "inc" and "dec" for +1 and -1. "add" and "sub" are heftier and
> get used for everything else.

Do we really? I don't know if there are any microarchitectures where the
partial register update still matters. It is only one byte difference.

-hpa