Skip to contentSkip to conversation

x86: Move x86_cpu_to_apicid to the __read_mostly section

PATCH In review Vlad Zolotarov 2 participants 4 messages Apr 24, 2012 – May 7, 2012 x86

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 x86: Move x86_cpu_to_apicid to the __read_mostly section

From: Shai Fultheim <[email protected]>

x86_cpu_to_apicid is only written to during initialization. Benchmarks show that moving it to the __read_mostly section helps avoid false sharing on large multiprocessing systems.

---
 arch/x86/include/asm/smp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/smp.h +1 -1
index 0434c40..b9d6c1e 100644
@@ -53,7 +53,7 @@ static inline struct cpumask *cpu_llc_shared_mask(int cpu)
 	return per_cpu(cpu_llc_shared_map, cpu);
 }
 
-DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
+DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
 DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
 DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid);
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 17 lines · Vlad Zolotarov

From: Shai Fultheim <[email protected]>

x86_cpu_to_apicid is only written to during initialization. Benchmarks show that moving it to the __read_mostly section helps avoid false sharing on large multiprocessing systems.

---
 arch/x86/include/asm/smp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/smp.h +0 -0
index 0434c40..b9d6c1e 100644

arch/x86/include/asm/smp.h static inline struct cpumask *cpu_llc_shared_mask(int cpu) · line 59

Quoted 8 lines
arch/x86/include/asm/smp.h +1 -1
@@ -53,7 +53,7 @@ static inline struct cpumask *cpu_llc_shared_mask(int cpu)
 	return per_cpu(cpu_llc_shared_map, cpu);
 }
 
-DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
+DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
 DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32)
 DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid);

Looks like all of the surrounding fields are read mostly as well, only initialized very rarely, during cpu init?

Thanks,

Ingo

#2 lore raw
Quoted 28 lines · Ingo Molnar
Quoted 27 lines · Vlad Zolotarov

From: Shai Fultheim <[email protected]>

x86_cpu_to_apicid is only written to during initialization. Benchmarks show that moving it to the __read_mostly section helps avoid false sharing on large multiprocessing systems.

---

 arch/x86/include/asm/smp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/smp.h +1 -1
index 0434c40..b9d6c1e 100644
@@ -53,7 +53,7 @@ static inline struct cpumask *cpu_llc_shared_mask(int
 cpu)
 
 	return per_cpu(cpu_llc_shared_map, cpu);
 
 }
 
-DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
+DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
Quoted 6 lines
Quoted 3 lines

DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid);

Looks like all of the surrounding fields are read mostly as well, only initialized very rarely, during cpu init?

U r right. At least x86_bios_cpu_apicid is read mostly as well. I'll fix and respin.

Did u have a chance to look at the other "__read_mostly" patch for fs/buffer.c I've sent?

thanks,
vlad

Quoted 9 lines

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 36 lines · Vlad Zolotarov
Quoted 28 lines · Ingo Molnar
Quoted 27 lines · Vlad Zolotarov

From: Shai Fultheim <[email protected]>

x86_cpu_to_apicid is only written to during initialization. Benchmarks show that moving it to the __read_mostly section helps avoid false sharing on large multiprocessing systems.

---

 arch/x86/include/asm/smp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/smp.h +1 -1
index 0434c40..b9d6c1e 100644
@@ -53,7 +53,7 @@ static inline struct cpumask *cpu_llc_shared_mask(int
 cpu)
 
 	return per_cpu(cpu_llc_shared_map, cpu);
 
 }
 
-DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
+DECLARE_EARLY_PER_CPU_READ_MOSTLY(u16, x86_cpu_to_apicid);
Quoted 6 lines
Quoted 3 lines

DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid);

Looks like all of the surrounding fields are read mostly as well, only initialized very rarely, during cpu init?

Quoted 2 lines

U r right. At least x86_bios_cpu_apicid is read mostly as well. I'll fix and respin.

Thanks.

Quoted 2 lines

Did u have a chance to look at the other "__read_mostly" patch for fs/buffer.c I've sent?

Haven't been involved with fs/buffer.c for some time, please send it to the relevant maintainer:

 $ scripts/get_maintainer.pl -f fs/buffer.c 
 Alexander Viro <[email protected]> (maintainer:FILESYSTEMS (VFS...)
 [email protected] (open list:FILESYSTEMS (VFS...)
 [email protected] (open list)

Thanks,

Ingo