Re: [PATCH] APICID: Avoid false sharing on the read mostlyx86_cpu_to_apicid

From: David Rientjes
Date: Wed Oct 26 2011 - 02:21:47 EST


On Tue, 25 Oct 2011, Eial Czerwacki wrote:

> Avoid false sharing on the read mostly x86_cpu_to_apicid by moving it to
> __read_mostly section.

x86_cpu_to_apicid used to be in .init.data and now it's never freed after
boot?

> The per-cpu area is write and read and this symbol shows up high on ipi
> intensive/x86_cpu_to_apicid load.
>
> Signed-off-by: Eial Czerwacki<eial@xxxxxxxxxxx>
> Signed-off-by: Shai Fultheim<shai@xxxxxxxxxxx>
> Author: Ravikiran Thirumalai<kiran@xxxxxxxxxxxx>

If the author isn't you, then the patch should start with a single line
that says "From: name <email>" of the author followed by a blank line.
It's also strange that the author doesn't have a sign-off line.

Your email client also has corrupted the inline patch, please see
Documentation/email-clients.txt.

And, finally, please send this to the x86 maintainers once fixed. See
./scripts/get_maintainers.pl <your patch>.

> Index: b/arch/x86/include/asm/smp.h
> ===================================================================
> --- a/arch/x86/include/asm/smp.h 2010-06-01 09:56:03.000000000 -0700
> +++ b/arch/x86/include/asm/smp.h 2010-06-02 15:59:21.000000000 -0700
> @@ -36,7 +36,8 @@ static inline struct cpumask *cpu_core_m
> return per_cpu(cpu_core_map, cpu);
> }
>
> -DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
> +extern u16 x86_cpu_to_apicid[NR_CPUS];
> +
> DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
>
> /* Static state in head.S used to set up a CPU */
> @@ -142,7 +143,7 @@ void native_send_call_func_ipi(const str
> void native_send_call_func_single_ipi(int cpu);
>
> void smp_store_cpu_info(int id);
> -#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
> +#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu]
>
> /* We don't mark CPUs online until __cpu_up(), so we need another measure */
> static inline int num_booting_cpus(void)
> Index: b/arch/x86/kernel/acpi/boot.c
> ===================================================================
> --- a/arch/x86/kernel/acpi/boot.c 2010-06-01 09:56:03.000000000 -0700
> +++ b/arch/x86/kernel/acpi/boot.c 2010-06-02 15:59:21.000000000 -0700
> @@ -568,7 +568,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
>
> int acpi_unmap_lsapic(int cpu)
> {
> - per_cpu(x86_cpu_to_apicid, cpu) = -1;
> + x86_cpu_to_apicid[cpu] = -1;
> set_cpu_present(cpu, false);
> num_processors--;
>

Shouldn't this be BAD_APICID? Not sure where we check for -1.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/