Skip to contentSkip to conversation

: sparc64: Use new dynamic per-cpu allocator.

PATCH In review David Miller 3 participants 5 messages Apr 9, 2009 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 12/12 : sparc64: Use new dynamic per-cpu allocator.

---
 arch/sparc/Kconfig         |    3 +
 arch/sparc/kernel/smp_64.c |  165 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 159 insertions(+), 9 deletions(-)
arch/sparc/Kconfig +3 -0
index cc12cd4..2185cf9 100644
@@ -93,6 +93,9 @@ config AUDIT_ARCH
 config HAVE_SETUP_PER_CPU_AREA
 	def_bool y if SPARC64
 
+config HAVE_DYNAMIC_PER_CPU_AREA
+	def_bool y if SPARC64
+
 config GENERIC_HARDIRQS_NO__DO_IRQ
 	bool
 	def_bool y if SPARC64
arch/sparc/kernel/smp_64.c +156 -9

181 lines not on this page · raw message

Signature · 1 line
1.6.2.2
#1 lore raw
Quoted 12 lines · David Miller
---
 arch/sparc/Kconfig         |    3 +
 arch/sparc/kernel/smp_64.c |  165 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 159 insertions(+), 9 deletions(-)
arch/sparc/Kconfig +0 -0
index cc12cd4..2185cf9 100644

arch/sparc/Kconfig config AUDIT_ARCH · line 98

Quoted 6 lines
arch/sparc/Kconfig +3 -0
@@ -93,6 +93,9 @@ config AUDIT_ARCH
 config HAVE_SETUP_PER_CPU_AREA
 	def_bool y if SPARC64
 
+config HAVE_DYNAMIC_PER_CPU_AREA
+	def_bool y if SPARC64
+

Not related to this specific patch - but I wonder if there is any good reason these HAVE_ varaibles do not follow the normal pattern with one definition
and users using select to enable it.

Sam

#2 lore raw
In reply to David Miller

Hello,

The percpu part looks good to me. Just one question below.

arch/sparc/kernel/smp_64.c void smp_send_stop(void) · line 1495

Quoted 13 lines · David Miller

void __init setup_per_cpu_areas(void)
{

arch/sparc/kernel/smp_64.c +9 -2
-	unsigned long size, i, nr_possible_cpus = num_possible_cpus();
-	char *ptr;
+	size_t dyn_size, static_size = __per_cpu_end - __per_cpu_start;
+	static struct vm_struct vm;
+	unsigned long delta, cpu;
+	size_t pcpu_unit_size;
+	size_t ptrs_size;
+
+	pcpur_size = PFN_ALIGN(static_size + PERCPU_MODULE_RESERVE +
+			       PERCPU_DYNAMIC_RESERVE);
+	dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE;

Isn't it better to use embedding allocator for !NUMA cases (one less TLB entry usage for each CPU)?

Thanks.

Signature · 1 line
tejun
author maintainer
#3 lore raw

From: Tejun Heo <[email protected]>
Date: Thu, 09 Apr 2009 04:48:12 -0700

Quoted 18 lines

arch/sparc/kernel/smp_64.c void smp_send_stop(void) · line 1495

Quoted 13 lines · David Miller

void __init setup_per_cpu_areas(void)
{

arch/sparc/kernel/smp_64.c +9 -2
-	unsigned long size, i, nr_possible_cpus = num_possible_cpus();
-	char *ptr;
+	size_t dyn_size, static_size = __per_cpu_end - __per_cpu_start;
+	static struct vm_struct vm;
+	unsigned long delta, cpu;
+	size_t pcpu_unit_size;
+	size_t ptrs_size;
+
+	pcpur_size = PFN_ALIGN(static_size + PERCPU_MODULE_RESERVE +
+			       PERCPU_DYNAMIC_RESERVE);
+	dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE;

Isn't it better to use embedding allocator for !NUMA cases (one less TLB entry usage for each CPU)?

Heck, the embedding case would probably be optimal for Niagara NUMA systems too.

On Niagara systems all of the "possible" cpu numbers are linear and in order. No holes, gaps, or other stuff like this. So just allocating big TLB mapping chunks and chopping them up to the individual cpus is the best scheme possible.

Indeed, these are the kinds of things I plan to experiment with.

#4 lore raw
Quoted 10 lines · David Miller
Quoted 2 lines

Isn't it better to use embedding allocator for !NUMA cases (one less TLB entry usage for each CPU)?

Heck, the embedding case would probably be optimal for Niagara NUMA systems too.

On Niagara systems all of the "possible" cpu numbers are linear and in order. No holes, gaps, or other stuff like this. So just allocating big TLB mapping chunks and chopping them up to the individual cpus is the best scheme possible.

Sounds great. I wonder whether the remap allocator could be replaced with embed allocator with right parameters on x86 too.

Thanks.

Signature · 1 line
tejun