Re: [PATCH v4 15/16] locking/rwsem: Merge owner into count on x86-64

From: Peter Zijlstra
Date: Thu Apr 18 2019 - 10:28:50 EST


On Sat, Apr 13, 2019 at 01:22:58PM -0400, Waiman Long wrote:
> +#ifdef CONFIG_X86_64
> +#define RWSEM_MERGE_OWNER_TO_COUNT
> +#endif

> +#ifdef RWSEM_MERGE_OWNER_TO_COUNT
> +
> +#ifdef __PHYSICAL_MASK_SHIFT
> +#define RWSEM_PA_MASK_SHIFT __PHYSICAL_MASK_SHIFT
> +#else
> +#define RWSEM_PA_MASK_SHIFT 52
> +#endif

I really dislike how this hardcodes x86_64.

It would be much better to have a CONFIG variable that gives us the
PA_BITS. Then all an architecture needs to do is set that right.

FWIW:

arch/arm64/Kconfig:config ARM64_PA_BITS_48
arch/arm64/Kconfig:config ARM64_PA_BITS_52

So ARM64 could also use this -- provided we get that overflow thing
sorted.