Re: [PATCH 10/13] x86/mm/pae: Be consistent with pXXp_get_and_clear()

From: Linus Torvalds
Date: Sat Oct 22 2022 - 13:54:14 EST


On Sat, Oct 22, 2022 at 4:48 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> +
> +#define pxx_xchg64(_pxx, _ptr, _val) ({ \
> + _pxx##val_t *_p = (_pxx##val_t *)_ptr; \
> + _pxx##val_t _o = *_p; \
> + do { } while (!try_cmpxchg64(_p, &_o, (_val))); \
> + native_make_##_pxx(_o); \
> +})

I think this could just be a "xchp64()", but if the pte/pmd code is
the only thing that actually wants this on 32-bit architectures, I'm
certainly ok with making it be specific to just this code, and calling
it "pxx_xchg()".

I wonder if there's some driver somewhere that wanted to use it, but
just made it be

depends on CONFIG_64BIT

instead, or made it use a cmpxchg64() loop because a plain xchg() didn't work.

I guess it really doesn't matter, with 32-bit being relegated to
legacy status anyway. No need to try to expand usage.

Linus