2007-06-14 06:14:51

by Paul Mundt

[permalink] [raw]
Subject: mm: Fix memory/cpu hotplug section mismatch and oops.

(This is a resend of the earlier patch, this issue still needs to be
fixed.)

When building with memory hotplug enabled and cpu hotplug disabled, we
end up with the following section mismatch:

WARNING: mm/built-in.o(.text+0x4e58): Section mismatch: reference to
.init.text: (between 'free_area_init_node' and '__build_all_zonelists')

This happens as a result of:

-> free_area_init_node()
-> free_area_init_core()
-> zone_pcp_init() <-- all __meminit up to this point
-> zone_batchsize() <-- marked as __cpuinit fo

This happens because CONFIG_HOTPLUG_CPU=n sets __cpuinit to __init, but
CONFIG_MEMORY_HOTPLUG=y unsets __meminit.

Changing zone_batchsize() to __devinit fixes this.

__devinit is the only thing that is common between CONFIG_HOTPLUG_CPU=y and
CONFIG_MEMORY_HOTPLUG=y. In the long run, perhaps this should be moved to
another section identifier completely. Without this, memory hot-add
of offline nodes (via hotadd_new_pgdat()) will oops if CPU hotplug is
not also enabled.

Signed-off-by: Paul Mundt <[email protected]>

--

mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bd8e335..05ace44 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1968,7 +1968,7 @@ void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone,
memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
#endif

-static int __cpuinit zone_batchsize(struct zone *zone)
+static int __devinit zone_batchsize(struct zone *zone)
{
int batch;


2007-06-14 09:34:18

by Yasunori Goto

[permalink] [raw]
Subject: Re: mm: Fix memory/cpu hotplug section mismatch and oops.


Thanks. I tested compile with cpu/memory hotplug off/on.
It was OK.

Acked-by: Yasunori Goto <[email protected]>


> (This is a resend of the earlier patch, this issue still needs to be
> fixed.)
>
> When building with memory hotplug enabled and cpu hotplug disabled, we
> end up with the following section mismatch:
>
> WARNING: mm/built-in.o(.text+0x4e58): Section mismatch: reference to
> .init.text: (between 'free_area_init_node' and '__build_all_zonelists')
>
> This happens as a result of:
>
> -> free_area_init_node()
> -> free_area_init_core()
> -> zone_pcp_init() <-- all __meminit up to this point
> -> zone_batchsize() <-- marked as __cpuinit fo
>
> This happens because CONFIG_HOTPLUG_CPU=n sets __cpuinit to __init, but
> CONFIG_MEMORY_HOTPLUG=y unsets __meminit.
>
> Changing zone_batchsize() to __devinit fixes this.
>
> __devinit is the only thing that is common between CONFIG_HOTPLUG_CPU=y and
> CONFIG_MEMORY_HOTPLUG=y. In the long run, perhaps this should be moved to
> another section identifier completely. Without this, memory hot-add
> of offline nodes (via hotadd_new_pgdat()) will oops if CPU hotplug is
> not also enabled.
>
> Signed-off-by: Paul Mundt <[email protected]>
>
> --
>
> mm/page_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index bd8e335..05ace44 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1968,7 +1968,7 @@ void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone,
> memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
> #endif
>
> -static int __cpuinit zone_batchsize(struct zone *zone)
> +static int __devinit zone_batchsize(struct zone *zone)
> {
> int batch;
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Yasunori Goto


2007-06-15 03:04:17

by Paul Mundt

[permalink] [raw]
Subject: Re: mm: Fix memory/cpu hotplug section mismatch and oops.

On Thu, Jun 14, 2007 at 06:32:32PM +0900, Yasunori Goto wrote:
> Thanks. I tested compile with cpu/memory hotplug off/on.
> It was OK.
>
> Acked-by: Yasunori Goto <[email protected]>
>
It would be nice to have this for 2.6.22..

2007-06-15 23:43:56

by Randy Dunlap

[permalink] [raw]
Subject: Re: mm: Fix memory/cpu hotplug section mismatch and oops.

On Fri, 15 Jun 2007 12:02:41 +0900 Paul Mundt wrote:

> On Thu, Jun 14, 2007 at 06:32:32PM +0900, Yasunori Goto wrote:
> > Thanks. I tested compile with cpu/memory hotplug off/on.
> > It was OK.
> >
> > Acked-by: Yasunori Goto <[email protected]>
> >
> It would be nice to have this for 2.6.22..

Yes, please.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

2007-06-15 23:57:50

by Linus Torvalds

[permalink] [raw]
Subject: Re: mm: Fix memory/cpu hotplug section mismatch and oops.



On Fri, 15 Jun 2007, Randy Dunlap wrote:

> On Fri, 15 Jun 2007 12:02:41 +0900 Paul Mundt wrote:
>
> > On Thu, Jun 14, 2007 at 06:32:32PM +0900, Yasunori Goto wrote:
> > > Thanks. I tested compile with cpu/memory hotplug off/on.
> > > It was OK.
> > >
> > > Acked-by: Yasunori Goto <[email protected]>
> > >
> > It would be nice to have this for 2.6.22..
>
> Yes, please.

I pushed out my tree that should include this one about ten minutes ago..

Linus