[PATCH] arm64: Add read_mostly declaration/definition to irq stack ptr
Will Deacon
will at kernel.org
Wed Feb 16 09:09:47 PST 2022
On Mon, Feb 07, 2022 at 04:46:42PM +0800, Jisheng Zhang wrote:
> Add "read-mostly" qualifier to irq_stack_ptr and
> irq_shadow_call_stack_ptr. This is to prevent the false sharing.
>
> Before the patch, I got below percpu layout with one defconfig:
> ffffffc008723050 <mde_ref_count>:
> ffffffc008723050: 00 00 00 00
> ....
>
> ffffffc008723054 <kde_ref_count>:
> ffffffc008723054: 00 00 00 00
> ....
>
> ffffffc008723058 <irq_stack_ptr>:
> ...
>
> ffffffc008723060 <nmi_contexts>:
> ...
>
> ffffffc008723070 <fpsimd_last_state>:
>
> As can be seen, the irq_stack_ptr sits with the heavy read/write percpu
> vars such as fpsimd_last_state etc. at the same cacheline.
>
> After the patch:
>
> ffffffc008723000 <irq_stack_ptr>:
> ...
>
> ffffffc008723008 <cpu_number>:
> ...
>
> ffffffc008723010 <arm64_ssbd_callback_required>:
> ...
>
> ffffffc008723018 <bp_hardening_data>:
> ...
>
> Now, the irq_stack_ptr sits with read mostly percpu vars such as
> cpu_number etc. at the same cacheline.
Were you able to measure any performance difference after this change?
Will
More information about the linux-arm-kernel
mailing list