bootmem.c: Avoid c90 declaration warning
Subsystems (3)
PATCH 1/1 bootmem.c: Avoid c90 declaration warning
mm/bootmem.c +2 -0
@@ -536,11 +536,13 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,return kzalloc (size,GFP_NOWAIT );#ifdef CONFIG_HAVE_ARCH_BOOTMEM + {bootmem_data_t *p_bdata; p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit);if (p_bdata)return alloc_bootmem_core (p_bdata, size, align, goal, limit); + }#endif return NULL ; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 10 lines · On Thu, 18 Jun 2009 13:07:13 -0700 Joe Perches <[email protected]> wrote:
Signed-off-by Joe Perches <[email protected]>mm/bootmem.c +0
-0@@ -536,11 +536,13 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,return kzalloc (size,GFP_NOWAIT );#ifdef CONFIG_HAVE_ARCH_BOOTMEM
mm/bootmem.c static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, · line 548
Quoted 10 lines
mm/bootmem.c +2
-0+ {bootmem_data_t *p_bdata; p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit);if (p_bdata)return alloc_bootmem_core (p_bdata, size, align, goal, limit); + }#endif return NULL ; }
Well yes.
We'll be needing some tabs there.
Unrelatedly, I'm struggling a bit with bootmem_arch_preferred_node(). It's only defined if CONFIG_X86_32=y && CONFIG_NEED_MULTIPLE_NODES=y, but it gets called if CONFIG_HAVE_ARCH_BOOTMEM=y.
Is this correct, logical and as simple as we can make it??
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 26 lines · Andrew Morton
Quoted 10 lines · On Thu, 18 Jun 2009 13:07:13 -0700 Joe Perches <[email protected]> wrote:
Signed-off-by Joe Perches <[email protected]>mm/bootmem.c +0
-0@@ -536,11 +536,13 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,return kzalloc (size,GFP_NOWAIT );#ifdef CONFIG_HAVE_ARCH_BOOTMEM mm/bootmem.c static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, · line 548
Quoted 10 lines
mm/bootmem.c +2
-0+ {bootmem_data_t *p_bdata; p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit);if (p_bdata)return alloc_bootmem_core (p_bdata, size, align, goal, limit); + }#endif return NULL ; }Well yes.
Quoted 7 lines
We'll be needing some tabs there.
Unrelatedly, I'm struggling a bit with
bootmem_arch_preferred_node(). It's only defined ifCONFIG_X86_32=y&&CONFIG_NEED_MULTIPLE_NODES=y, but it gets called ifCONFIG_HAVE_ARCH_BOOTMEM=y.Is this correct, logical and as simple as we can make it??
x86_32 numa is the only setter of HAVE_ARCH_BOOTMEM. I don't know why this arch has a strict preference/requirement(?) for bootmem on node 0.
I found this mail from Yinghai
http://marc.info/?l=linux-kernel&m=123614990906256&w=2
where he says that it expects all bootmem on node zero but with the current code and alloc_arch_preferred_bootmem() failing, we could fall back to another node. Won't this break? Yinghai?
Otherwise, could we perhaps use something as simple as this?
arch/x86/include/asm/mmzone_32.h +1 -2
@@ -92,8 +92,7 @@ static inline int pfn_valid(int pfn)#ifdef CONFIG_NEED_MULTIPLE_NODES /* always use node 0 for bootmem on this numa platform */ -#define bootmem_arch_preferred_node (__bdata, size, align, goal, limit) \ - (NODE_DATA(0)->bdata) +#define bootmem_arch_preferred_node (NODE(0)->bdata)#endif /* CONFIG_NEED_MULTIPLE_NODES */ #endif /* _ASM_X86_MMZONE_32_H */
mm/bootmem.c +8 -23
@@ -528,23 +528,6 @@ find_block:return NULL ; } -static void *__init alloc_arch_preferred_bootmem (bootmem_data_t *bdata, -unsigned long size,unsigned long align, -unsigned long goal,unsigned long limit) -{ -if (WARN_ON_ONCE (slab_is_available ())) -return kzalloc (size,GFP_NOWAIT ); - -#ifdef CONFIG_HAVE_ARCH_BOOTMEM -bootmem_data_t *p_bdata; - - p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit); -if (p_bdata) -return alloc_bootmem_core (p_bdata, size, align, goal, limit); -#endif -return NULL ; -} - static void * __init ___alloc_bootmem_nopanic(unsigned long size, unsigned long align, unsigned long goal,
@@ -553,11 +536,15 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,bootmem_data_t *bdata;void *region; +if (WARN_ON_ONCE (slab_is_available ())) +return kzalloc (size,GFP_NOWAIT ); restart: - region =alloc_arch_preferred_bootmem (NULL , size, align, goal, limit); +#ifdef bootmem_arch_preferred_node + region =alloc_bootmem_core (bootmem_arch_preferred_node, + size, align, goal, limit);if (region)return region; - +#endif list_for_each_entry (bdata, &bdata_list, list) {if (goal && bdata->node_low_pfn <=PFN_DOWN (goal))continue ;
@@ -636,13 +623,11 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, {void *ptr; - ptr =alloc_arch_preferred_bootmem (bdata, size, align, goal, limit); -if (ptr) -return ptr; - +#ifndef bootmem_arch_preferred_node ptr =alloc_bootmem_core (bdata, size, align, goal, limit);if (ptr)return ptr; +#endif return ___alloc_bootmem (size, align, goal, limit); }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 38 lines · Johannes Weiner
Quoted 25 lines · Andrew Morton
Quoted 10 lines · On Thu, 18 Jun 2009 13:07:13 -0700 Joe Perches <[email protected]> wrote:
Signed-off-by Joe Perches <[email protected]>mm/bootmem.c +0
-0@@ -536,11 +536,13 @@ static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata,return kzalloc (size,GFP_NOWAIT );#ifdef CONFIG_HAVE_ARCH_BOOTMEM mm/bootmem.c static void * __init alloc_arch_preferred_bootmem(bootmem_data_t *bdata, · line 548
Quoted 10 lines
mm/bootmem.c +2
-0+ {bootmem_data_t *p_bdata; p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit);if (p_bdata)return alloc_bootmem_core (p_bdata, size, align, goal, limit); + }#endif return NULL ; }Well yes.
Quoted 7 lines
We'll be needing some tabs there.
Unrelatedly, I'm struggling a bit with
bootmem_arch_preferred_node(). It's only defined ifCONFIG_X86_32=y&&CONFIG_NEED_MULTIPLE_NODES=y, but it gets called ifCONFIG_HAVE_ARCH_BOOTMEM=y.Is this correct, logical and as simple as we can make it??
x86_32numa is the only setter ofHAVE_ARCH_BOOTMEM. I don't know why this arch has a strict preference/requirement(?) for bootmem on node 0.
Quoted 7 lines
I found this mail from Yinghai
http://marc.info/?l=linux-kernel&m=123614990906256&w=2
where he says that it expects all bootmem on node zero but with the current code and
alloc_arch_preferred_bootmem()failing, we could fall back to another node. Won't this break? Yinghai?
not sure it is the same problem. the fix was in mainline already.
Quoted 69 lines
Otherwise, could we perhaps use something as simple as this?
arch/x86/include/asm/mmzone_32.h +1
-2@@ -92,8 +92,7 @@ static inline int pfn_valid(int pfn)#ifdef CONFIG_NEED_MULTIPLE_NODES /* always use node 0 for bootmem on this numa platform */ -#define bootmem_arch_preferred_node (__bdata, size, align, goal, limit) \ - (NODE_DATA(0)->bdata) +#define bootmem_arch_preferred_node (NODE(0)->bdata)#endif /* CONFIG_NEED_MULTIPLE_NODES */ #endif /* _ASM_X86_MMZONE_32_H */ mm/bootmem.c +6
-21@@ -528,23 +528,6 @@ find_block:return NULL ; } -static void *__init alloc_arch_preferred_bootmem (bootmem_data_t *bdata, -unsigned long size,unsigned long align, -unsigned long goal,unsigned long limit) -{ -if (WARN_ON_ONCE (slab_is_available ())) -return kzalloc (size,GFP_NOWAIT ); - -#ifdef CONFIG_HAVE_ARCH_BOOTMEM -bootmem_data_t *p_bdata; - - p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit); -if (p_bdata) -return alloc_bootmem_core (p_bdata, size, align, goal, limit); -#endif -return NULL ; -} - static void * __init ___alloc_bootmem_nopanic(unsigned long size, unsigned long align, unsigned long goal,@@ -553,11 +536,15 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,bootmem_data_t *bdata;void *region; +if (WARN_ON_ONCE (slab_is_available ())) +return kzalloc (size,GFP_NOWAIT ); restart: - region =alloc_arch_preferred_bootmem (NULL , size, align, goal, limit); +#ifdef bootmem_arch_preferred_node + region =alloc_bootmem_core (bootmem_arch_preferred_node, + size, align, goal, limit);if (region)return region; - +#endif list_for_each_entry (bdata, &bdata_list, list) {if (goal && bdata->node_low_pfn <=PFN_DOWN (goal))continue ;@@ -636,13 +623,11 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, {void *ptr; - ptr =alloc_arch_preferred_bootmem (bdata, size, align, goal, limit); -if (ptr)
mm/bootmem.c static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, · line 633
Quoted 10 lines
mm/bootmem.c +2
-2-return ptr; - +#ifndef bootmem_arch_preferred_node ptr =alloc_bootmem_core (bdata, size, align, goal, limit);if (ptr)return ptr; +#endif return ___alloc_bootmem (size, align, goal, limit); }
any reason to kill alloc_arch_preferred_bootmem?
YH
commit a71edd1f46c8a599509bda478fb4eea27fb0da63
Author: Yinghai Lu <[email protected]> Date: Wed Mar 4 01:22:35 2009 -0800
x86: fix bootmem cross node for 32bit numa
Impact: fix panic on system 2g x4 sockets
Found one system with 4 sockets and every sockets has 2g can not boot with numa32 because boot mem is crossing nodes.
So try to have numa version of setup_bootmem_allocator().
LKML-Reference: <[email protected]>
arch/x86/mm/init_32.c +40 -6
@@ -776,9 +776,37 @@ static void __init zone_sizes_init(void)free_area_init_nodes (max_zone_pfns); } +#ifdef CONFIG_NEED_MULTIPLE_NODES +static unsigned long __init setup_node_bootmem (int nodeid, +unsigned long start_pfn, +unsigned long end_pfn, +unsigned long bootmap) +{ +unsigned long bootmap_size; + +if (start_pfn > max_low_pfn) +return bootmap; +if (end_pfn > max_low_pfn) + end_pfn = max_low_pfn; + +/* don't touch min_low_pfn */ + bootmap_size =init_bootmem_node (NODE_DATA (nodeid), + bootmap >>PAGE_SHIFT , + start_pfn, end_pfn); +printk (KERN_INFO " node %d low ram: %08lx - %08lx\n" , + nodeid, start_pfn<<PAGE_SHIFT , end_pfn<<PAGE_SHIFT ); +printk (KERN_INFO " node %d bootmap %08lx - %08lx\n" , + nodeid, bootmap, bootmap + bootmap_size); +free_bootmem_with_active_regions (nodeid, end_pfn); +early_res_to_bootmem (start_pfn<<PAGE_SHIFT , end_pfn<<PAGE_SHIFT ); + +return bootmap + bootmap_size; +} +#endif +void __init setup_bootmem_allocator (void ) { -int i; +int nodeid;unsigned long bootmap_size, bootmap;/* * Initialize the boot-time allocator (with low memory only):
@@ -791,18 +819,24 @@ void __init setup_bootmem_allocator(void)panic ("Cannot find bootmem map of size %ld\n" , bootmap_size);reserve_early (bootmap, bootmap + bootmap_size,"BOOTMAP" ); -/* don't touch min_low_pfn */ - bootmap_size =init_bootmem_node (NODE_DATA (0 ), bootmap >>PAGE_SHIFT , - min_low_pfn, max_low_pfn);printk (KERN_INFO " mapped low ram: 0 - %08lx\n" , max_pfn_mapped<<PAGE_SHIFT );printk (KERN_INFO " low ram: %08lx - %08lx\n" , min_low_pfn<<PAGE_SHIFT , max_low_pfn<<PAGE_SHIFT ); + +#ifdef CONFIG_NEED_MULTIPLE_NODES +for_each_online_node (nodeid) + bootmap =setup_node_bootmem (nodeid, node_start_pfn[nodeid], + node_end_pfn[nodeid], bootmap); +#else +/* don't touch min_low_pfn */ + bootmap_size =init_bootmem_node (NODE_DATA (0 ), bootmap >>PAGE_SHIFT , + min_low_pfn, max_low_pfn);printk (KERN_INFO " bootmap %08lx - %08lx\n" , bootmap, bootmap + bootmap_size); -for_each_online_node (i) -free_bootmem_with_active_regions (i, max_low_pfn); +free_bootmem_with_active_regions (0 , max_low_pfn);early_res_to_bootmem (0 , max_low_pfn<<PAGE_SHIFT ); +#endif after_init_bootmem =1 ; }
arch/x86/mm/numa_32.c +3 -2
@@ -416,10 +416,11 @@ void __init initmem_init(unsigned long start_pfn,for_each_online_node (nid)propagate_e820_map_node (nid); -for_each_online_node (nid) +for_each_online_node (nid) {memset (NODE_DATA (nid),0 ,sizeof (struct pglist_data )); +NODE_DATA (nid)->bdata = &bootmem_node_data[nid]; + } -NODE_DATA (0 )->bdata = &bootmem_node_data[0 ];setup_bootmem_allocator (); }
commit fc5efe3941c47c0278fe1bbcf8cc02a03a74fcda
Author: Yinghai Lu <[email protected]> Date: Wed Mar 4 12:21:24 2009 -0800
x86: fix bootmem cross node for 32bit numa, cleanup
Impact: clean up
Simplify the code, reuse some lines.
Remove min_low_pfn reference, it is always 0
LKML-Reference: <[email protected]>
arch/x86/mm/init_32.c +3 -13
@@ -776,7 +776,6 @@ static void __init zone_sizes_init(void)free_area_init_nodes (max_zone_pfns); } -#ifdef CONFIG_NEED_MULTIPLE_NODES static unsigned long __init setup_node_bootmem(int nodeid, unsigned long start_pfn, unsigned long end_pfn,
@@ -802,7 +801,6 @@ static unsigned long __init setup_node_bootmem(int nodeid,return bootmap + bootmap_size; } -#endif void __init setup_bootmem_allocator (void ) {
@@ -812,8 +810,7 @@ void __init setup_bootmem_allocator(void)* Initialize the boot-time allocator (with low memory only): */ bootmap_size =bootmem_bootmap_pages (max_low_pfn)<<PAGE_SHIFT ; - bootmap =find_e820_area (min_low_pfn<<PAGE_SHIFT , - max_pfn_mapped<<PAGE_SHIFT , bootmap_size, + bootmap =find_e820_area (0 , max_pfn_mapped<<PAGE_SHIFT , bootmap_size,PAGE_SIZE );if (bootmap ==-1L )panic ("Cannot find bootmem map of size %ld\n" , bootmap_size);
@@ -821,21 +818,14 @@ void __init setup_bootmem_allocator(void)printk (KERN_INFO " mapped low ram: 0 - %08lx\n" , max_pfn_mapped<<PAGE_SHIFT ); -printk (KERN_INFO " low ram: %08lx - %08lx\n" , - min_low_pfn<<PAGE_SHIFT , max_low_pfn<<PAGE_SHIFT ); +printk (KERN_INFO " low ram: 0 - %08lx\n" , max_low_pfn<<PAGE_SHIFT );#ifdef CONFIG_NEED_MULTIPLE_NODES for_each_online_node (nodeid) bootmap =setup_node_bootmem (nodeid, node_start_pfn[nodeid], node_end_pfn[nodeid], bootmap);#else -/* don't touch min_low_pfn */ - bootmap_size =init_bootmem_node (NODE_DATA (0 ), bootmap >>PAGE_SHIFT , - min_low_pfn, max_low_pfn); -printk (KERN_INFO " bootmap %08lx - %08lx\n" , - bootmap, bootmap + bootmap_size); -free_bootmem_with_active_regions (0 , max_low_pfn); -early_res_to_bootmem (0 , max_low_pfn<<PAGE_SHIFT ); + bootmap =setup_node_bootmem (0 ,0 , max_low_pfn, bootmap);#endif after_init_bootmem =1 ;
Quoted 14 lines · Yinghai Lu
Quoted 13 lines · Johannes Weiner
Quoted 5 lines · Andrew Morton
Unrelatedly, I'm struggling a bit with
bootmem_arch_preferred_node(). It's only defined ifCONFIG_X86_32=y&&CONFIG_NEED_MULTIPLE_NODES=y, but it gets called ifCONFIG_HAVE_ARCH_BOOTMEM=y.Is this correct, logical and as simple as we can make it??
x86_32numa is the only setter ofHAVE_ARCH_BOOTMEM. I don't know why this arch has a strict preference/requirement(?) for bootmem on node 0.I found this mail from Yinghai
Quoted 7 lines
Quoted 5 lines
http://marc.info/?l=linux-kernel&m=123614990906256&w=2
where he says that it expects all bootmem on node zero but with the current code and
alloc_arch_preferred_bootmem()failing, we could fall back to another node. Won't this break? Yinghai?not sure it is the same problem. the fix was in mainline already.
I just wanted to know if the requirement for bootmem on node 0 is strict or just a preference. Do you perhaps happen to know? :)
Quoted 76 lines
Quoted 76 lines
Otherwise, could we perhaps use something as simple as this?
arch/x86/include/asm/mmzone_32.h +1
-2@@ -92,8 +92,7 @@ static inline int pfn_valid(int pfn)#ifdef CONFIG_NEED_MULTIPLE_NODES /* always use node 0 for bootmem on this numa platform */ -#define bootmem_arch_preferred_node (__bdata, size, align, goal, limit) \ - (NODE_DATA(0)->bdata) +#define bootmem_arch_preferred_node (NODE(0)->bdata)#endif /* CONFIG_NEED_MULTIPLE_NODES */ #endif /* _ASM_X86_MMZONE_32_H */ mm/bootmem.c +8
-23@@ -528,23 +528,6 @@ find_block:return NULL ; } -static void *__init alloc_arch_preferred_bootmem (bootmem_data_t *bdata, -unsigned long size,unsigned long align, -unsigned long goal,unsigned long limit) -{ -if (WARN_ON_ONCE (slab_is_available ())) -return kzalloc (size,GFP_NOWAIT ); - -#ifdef CONFIG_HAVE_ARCH_BOOTMEM -bootmem_data_t *p_bdata; - - p_bdata =bootmem_arch_preferred_node (bdata, size, align, goal, limit); -if (p_bdata) -return alloc_bootmem_core (p_bdata, size, align, goal, limit); -#endif -return NULL ; -} - static void * __init ___alloc_bootmem_nopanic(unsigned long size, unsigned long align, unsigned long goal,@@ -553,11 +536,15 @@ static void * __init ___alloc_bootmem_nopanic(unsigned long size,bootmem_data_t *bdata;void *region; +if (WARN_ON_ONCE (slab_is_available ())) +return kzalloc (size,GFP_NOWAIT ); restart: - region =alloc_arch_preferred_bootmem (NULL , size, align, goal, limit); +#ifdef bootmem_arch_preferred_node + region =alloc_bootmem_core (bootmem_arch_preferred_node, + size, align, goal, limit);if (region)return region; - +#endif list_for_each_entry (bdata, &bdata_list, list) {if (goal && bdata->node_low_pfn <=PFN_DOWN (goal))continue ;@@ -636,13 +623,11 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, {void *ptr; - ptr =alloc_arch_preferred_bootmem (bdata, size, align, goal, limit); -if (ptr) -return ptr; - +#ifndef bootmem_arch_preferred_node ptr =alloc_bootmem_core (bdata, size, align, goal, limit);if (ptr)return ptr; +#endif
Quoted 5 lines
mm/bootmem.c static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata, · line 633
Quoted 2 lines
mm/bootmem.c +0
-0return ___alloc_bootmem (size, align, goal, limit); }any reason to kill
alloc_arch_preferred_bootmem?
Yeah, I think the diffstat is convincing hehe. And I think it looks more straight forward, but no strong feelings.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>