Skip to contentSkip to conversation

mm: setup_usemap() must be __meminit

PATCH In review Geert Uytterhoeven 2 participants 6 messages Feb 17, 2008 – Feb 18, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: setup_usemap() must be __meminit

On m68k (CONFIG_SPARSEMEM is not set), I get:

WARNING: vmlinux.o(.meminit.text+0x36c): Section mismatch in reference from the function free_area_init_core() to the function .init.text:setup_usemap() The function __meminit free_area_init_core() references
a function __init setup_usemap().
If free_area_init_core is only used by setup_usemap then
annotate free_area_init_core with a matching annotation.

If CONFIG_SPARSEMEM is set, the problem is not noticed because setup_usemap() is always inlined.

Properly annotating setup_usemap() and usemap_size() fixes it.

---
 mm/page_alloc.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
mm/page_alloc.c +6 -5
@@ -3241,7 +3241,7 @@ static void __meminit calculate_node_tot
  * round what is now in bits to nearest long in bits, then return it in
  * bytes.
  */
-static unsigned long __init usemap_size(unsigned long zonesize)
+static unsigned long __meminit usemap_size(unsigned long zonesize)
 {
 	unsigned long usemapsize;
 
@@ -3253,8 +3253,8 @@ static unsigned long __init usemap_size(
 	return usemapsize / 8;
 }
 
-static void __init setup_usemap(struct pglist_data *pgdat,
-				struct zone *zone, unsigned long zonesize)
+static void __meminit setup_usemap(struct pglist_data *pgdat,
+				   struct zone *zone, unsigned long zonesize)
 {
 	unsigned long usemapsize = usemap_size(zonesize);
 	zone->pageblock_flags = NULL;
@@ -3264,8 +3264,9 @@ static void __init setup_usemap(struct p
 	}
 }
 #else
-static void inline setup_usemap(struct pglist_data *pgdat,
-				struct zone *zone, unsigned long zonesize) {}
+static inline void __meminit setup_usemap(struct pglist_data *pgdat,
+					  struct zone *zone,
+					  unsigned long zonesize) {}
 #endif /* CONFIG_SPARSEMEM */
 
 #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#1 lore raw
Quoted 8 lines · Geert Uytterhoeven

On m68k (CONFIG_SPARSEMEM is not set), I get:

WARNING: vmlinux.o(.meminit.text+0x36c): Section mismatch in reference from the function free_area_init_core() to the function .init.text:setup_usemap() The function __meminit free_area_init_core() references
a function __init setup_usemap().
If free_area_init_core is only used by setup_usemap then
annotate free_area_init_core with a matching annotation.

Quoted 4 lines

If CONFIG_SPARSEMEM is set, the problem is not noticed because setup_usemap() is always inlined.

Properly annotating setup_usemap() and usemap_size() fixes it.

Woops, hit the send button too soon.

setup_usemap() calls alloc_bootmem_node(), causing a whole new avalanche of warnings to be fixed up :-(

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 12 lines · Geert Uytterhoeven
Quoted 11 lines · Geert Uytterhoeven

On m68k (CONFIG_SPARSEMEM is not set), I get:

WARNING: vmlinux.o(.meminit.text+0x36c): Section mismatch in reference from the function free_area_init_core() to the function .init.text:setup_usemap() The function __meminit free_area_init_core() references
a function __init setup_usemap().
If free_area_init_core is only used by setup_usemap then
annotate free_area_init_core with a matching annotation.

If CONFIG_SPARSEMEM is set, the problem is not noticed because setup_usemap() is always inlined.

Quoted 6 lines
Quoted 1 line

Properly annotating setup_usemap() and usemap_size() fixes it.

Woops, hit the send button too soon.

setup_usemap() calls alloc_bootmem_node(), causing a whole new avalanche of warnings to be fixed up :-(

Something you like me to help with?
I would need a config where the mismatch triggers for one of the more popular architectures (as in where I have a toolchain).

I could not reproduce it with x86 64bit - not even with -fno-inline-functions

Sam

#3 lore raw
Quoted 13 lines · Sam Ravnborg
Quoted 12 lines · Geert Uytterhoeven
Quoted 11 lines · Geert Uytterhoeven

On m68k (CONFIG_SPARSEMEM is not set), I get:

WARNING: vmlinux.o(.meminit.text+0x36c): Section mismatch in reference from the function free_area_init_core() to the function .init.text:setup_usemap() The function __meminit free_area_init_core() references
a function __init setup_usemap().
If free_area_init_core is only used by setup_usemap then
annotate free_area_init_core with a matching annotation.

If CONFIG_SPARSEMEM is set, the problem is not noticed because setup_usemap() is always inlined.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Properly annotating setup_usemap() and usemap_size() fixes it.

Woops, hit the send button too soon.

setup_usemap() calls alloc_bootmem_node(), causing a whole new avalanche of warnings to be fixed up :-(

Something you like me to help with?

Yes, that would be nice.

Quoted 2 lines

I would need a config where the mismatch triggers for one of the more popular architectures (as in where I have a toolchain).

That was with plain m68k defconfig.

Quoted 1 line

I could not reproduce it with x86 64bit - not even with -fno-inline-functions

If it helps, my cross-compiler is gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw
Quoted 10 lines
Quoted 3 lines

I would need a config where the mismatch triggers for one of the more popular architectures (as in where I have a toolchain).

That was with plain m68k defconfig.

Quoted 1 line

I could not reproduce it with x86 64bit - not even with -fno-inline-functions

If it helps, my cross-compiler is gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21).

I could build a m68k toolchin using crosstool. I will take a look one of the next days - too late now.

Sam

#5 lore raw
In reply to Geert Uytterhoeven
Quoted 16 lines · Geert Uytterhoeven
Quoted 15 lines · Sam Ravnborg
Quoted 14 lines · Geert Uytterhoeven
Quoted 12 lines · Geert Uytterhoeven

On m68k (CONFIG_SPARSEMEM is not set), I get:

WARNING: vmlinux.o(.meminit.text+0x36c): Section mismatch in reference from the function free_area_init_core() to the function .init.text:setup_usemap() The function __meminit free_area_init_core() references
a function __init setup_usemap().
If free_area_init_core is only used by setup_usemap then
annotate free_area_init_core with a matching annotation.

If CONFIG_SPARSEMEM is set, the problem is not noticed because setup_usemap() is always inlined.

Properly annotating setup_usemap() and usemap_size() fixes it.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Woops, hit the send button too soon.

setup_usemap() calls alloc_bootmem_node(), causing a whole new avalanche of warnings to be fixed up :-(

Something you like me to help with?

Yes, that would be nice.

I tried the patch posted by Alexander previously.
After reviewing it for some time I convinced myself the patch is correct (has stayed in my to-be-looked-at queue for a while).

See:
http://lkml.org/lkml/2008/2/3/129

I will ask Andrew to take it.

Sam