Skip to contentSkip to conversation

use new macros for x86 percpu readmostly section

PATCH In review Shaohua Li 2 participants 3 messages Dec 2, 2010 – Dec 10, 2010

Subsystems (2)
lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 3/3 use new macros for x86 percpu readmostly section

Use the new macros to correctly align percpu readmostly data.

---
 arch/x86/kernel/vmlinux.lds.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/vmlinux.lds.S +2 -2
Index: linux/arch/x86/kernel/vmlinux.lds.S
===================================================================
@@ -226,7 +226,7 @@ SECTIONS
 	 * output PHDR, so the next output section - .init.text - should
 	 * start another segment - init.
 	 */
-	PERCPU_VADDR(0, :percpu)
+	PERCPU_VADDR_CACHEALIGNED(0, :percpu, INTERNODE_CACHE_BYTES)
 #endif
 
 	INIT_TEXT_SECTION(PAGE_SIZE)
@@ -301,7 +301,7 @@ SECTIONS
 	}
 
 #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
-	PERCPU(THREAD_SIZE)
+	PERCPU_CACHEALIGNED(THREAD_SIZE, INTERNODE_CACHE_BYTES)
 #endif
 
 	. = ALIGN(PAGE_SIZE);
#1 lore raw
Quoted 22 lines · On Thu, 02 Dec 2010 10:02:30 +0800 Shaohua Li <[email protected]> wrote:

Use the new macros to correctly align percpu readmostly data.

---
 arch/x86/kernel/vmlinux.lds.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux/arch/x86/kernel/vmlinux.lds.S
===================================================================

arch/x86/kernel/vmlinux.lds.S +1 -1
@@ -226,7 +226,7 @@ SECTIONS
 	 * output PHDR, so the next output section - .init.text - should
 	 * start another segment - init.
 	 */
-	PERCPU_VADDR(0, :percpu)
+	PERCPU_VADDR_CACHEALIGNED(0, :percpu, INTERNODE_CACHE_BYTES)
 #endif
 
 	INIT_TEXT_SECTION(PAGE_SIZE)

arch/x86/kernel/vmlinux.lds.S SECTIONS · line 307

Quoted 8 lines
arch/x86/kernel/vmlinux.lds.S +1 -1
@@ -301,7 +301,7 @@ SECTIONS
 	}
 
 #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
-	PERCPU(THREAD_SIZE)
+	PERCPU_CACHEALIGNED(THREAD_SIZE, INTERNODE_CACHE_BYTES)
 #endif
 
 	. = ALIGN(PAGE_SIZE);

So what is the situation now with all other architectures? Should they be changed to correctly align their read-mostly percpu areas?

If so, what should the arch maintainers do to achieve this?

author
#2 lore raw
Quoted 31 lines · Andrew Morton
Quoted 28 lines · On Thu, 02 Dec 2010 10:02:30 +0800 Shaohua Li <[email protected]> wrote:

Use the new macros to correctly align percpu readmostly data.

---
 arch/x86/kernel/vmlinux.lds.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux/arch/x86/kernel/vmlinux.lds.S
===================================================================

arch/x86/kernel/vmlinux.lds.S +2 -2
@@ -226,7 +226,7 @@ SECTIONS
 	 * output PHDR, so the next output section - .init.text - should
 	 * start another segment - init.
 	 */
-	PERCPU_VADDR(0, :percpu)
+	PERCPU_VADDR_CACHEALIGNED(0, :percpu, INTERNODE_CACHE_BYTES)
 #endif
 
 	INIT_TEXT_SECTION(PAGE_SIZE)
@@ -301,7 +301,7 @@ SECTIONS
 	}
 
 #if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
-	PERCPU(THREAD_SIZE)
+	PERCPU_CACHEALIGNED(THREAD_SIZE, INTERNODE_CACHE_BYTES)
 #endif
 
Quoted 7 lines

arch/x86/kernel/vmlinux.lds.S SECTIONS · line 307

Quoted 2 lines
arch/x86/kernel/vmlinux.lds.S +0 -0
 	. = ALIGN(PAGE_SIZE);

So what is the situation now with all other architectures? Should they be changed to correctly align their read-mostly percpu areas?

If so, what should the arch maintainers do to achieve this?

Yes, other arch should use new macro too with correct cache alignment (similar like the alignment for read-mostly section). But currently only x86 has read-mostly percpu data.

Thanks,
Shaohua