Skip to contentSkip to conversation

percpu: kill compile warning in pcpu_populate_chunk()

PATCH In review Tejun Heo 2 participants 4 messages Mar 1, 2009 – Mar 2, 2009

Subsystems (4)
lore
Share & tools
lore

Tejun Heo

author maintainer
#0 lore raw

PATCH 1/3 percpu: kill compile warning in pcpu_populate_chunk()

Impact: remove compile warning

Mark local variable map_end in pcpu_populate_chunk() with uninitialized_var(). The variable is always used in tandem with map_start and guaranteed to be initialized before use but gcc doesn't understand that.

---
This the first of three misc fix patches for #tj-percpu. Patches are also available in the tj-percpu git tree.

git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git tj-percpu

Thanks.

 mm/percpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/percpu.c +1 -1
index 5954e7a..3d0f545 100644
@@ -639,7 +639,7 @@ static int pcpu_populate_chunk(struct pcpu_chunk *chunk, int off, int size)
 	int page_start = PFN_DOWN(off);
 	int page_end = PFN_UP(off + size);
 	int map_start = -1;
-	int map_end;
+	int uninitialized_var(map_end);
 	unsigned int cpu;
 	int i;
 
Signature · 1 line
1.6.0.2
author maintainer
#1 lore raw

PATCH 2/3 alpha: fix typo in recent early vmalloc change

Impact: fix build

Add missing 'o' in variable name. Compile tested.

---
 arch/alpha/mm/init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/alpha/mm/init.c +1 -1
index 91eddd8..af71d38 100644
@@ -202,7 +202,7 @@ callback_init(void * kernel_end)
 		console_remap_vm.size = nr_pages << PAGE_SHIFT;
 		vm_area_register_early(&console_remap_vm, PAGE_SIZE);
 
-		vaddr = (unsigned long)consle_remap_vm.addr;
+		vaddr = (unsigned long)console_remap_vm.addr;
 
 		/* Set up the third level PTEs and update the virtual
 		   addresses of the CRB entries.  */
Signature · 1 line
1.6.0.2
author maintainer
#2 lore raw

PATCH 3/3 bootmem, x86: further fixes for arch-specific bootmem wrapping

Impact: fix new breakages introduced by previous fix

Commit c132937556f56ee4b831ef4b23f1846e05fde102 tried to clean up bootmem arch wrapper but it wasn't quite correct. Before the commit, the followings were broken.

* Low level interface functions prefixed with __ ignored arch preference.

* reserve_bootmem(...) can't be mapped into reserve_bootmem_node(NODE_DATA(0)->bdata, ...) because the node is not preference here. The region specified MUST fall into the specified region; otherwise, it will panic.

After the commit,

* If allocation fails for the arch preferred node, it should fallback to whatever is available. Instead, it simply failed allocation.

There are too many internal details to allow generic wrapping and still keep things simple for archs. Plus, all that arch wants is a way to prefer certain node over another.

This patch drops the generic wrapping around alloc_bootmem_core() and add alloc_bootmem_core() instead. If necessary, arch can define bootmem_arch_referred_node() macro or function which takes all allocation information and returns the preferred node. bootmem generic code will always try the preferred node first and then fallback to other nodes as usual.

Breakages noted and changes reviewed by Johannes Weiner.

---
 arch/x86/include/asm/mmzone_32.h |    8 +-----
 mm/bootmem.c                     |   45 +++++++++++++++++++++++++------------
 2 files changed, 32 insertions(+), 21 deletions(-)
arch/x86/include/asm/mmzone_32.h +2 -6
index eeacf67..ede6998 100644
@@ -92,12 +92,8 @@ static inline int pfn_valid(int pfn)
 
 #ifdef CONFIG_NEED_MULTIPLE_NODES
 /* always use node 0 for bootmem on this numa platform */
-#define alloc_bootmem_core(__bdata, size, align, goal, limit)		\
-({									\
-	bootmem_data_t __maybe_unused *	__abm_bdata_dummy = (__bdata);	\
-	__alloc_bootmem_core(NODE_DATA(0)->bdata,			\
-			     (size), (align), (goal), (limit));		\
-})
+#define bootmem_arch_preferred_node(__bdata, size, align, goal, limit)	\
+	(NODE_DATA(0)->bdata)
 #endif /* CONFIG_NEED_MULTIPLE_NODES */
 
 #endif /* _ASM_X86_MMZONE_32_H */
mm/bootmem.c +30 -15

84 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#3 lore raw
In reply to Tejun Heo
Quoted 7 lines · Tejun Heo

Impact: remove compile warning

Mark local variable map_end in pcpu_populate_chunk() with uninitialized_var(). The variable is always used in tandem with map_start and guaranteed to be initialized before use but gcc doesn't understand that.

Quoted 7 lines

---
This the first of three misc fix patches for #tj-percpu. Patches are also available in the tj-percpu git tree.

git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git tj-percpu

Pulled, thanks Tejun.

Ingo