* [Patch] Fix section mismatch of memory hotplug related code.
@ 2007-04-05 8:01 Yasunori Goto
2007-05-05 0:04 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Yasunori Goto @ 2007-04-05 8:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel ML, Miles Lane, Sam Ravnborg
Hello.
This is to fix many section mismatches of code related to memory hotplug.
I checked compile with memory hotplug on/off on ia64 and x86-64 box.
This patch is for 2.6.21-rc5-mm4.
Please apply.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
-----------
arch/ia64/mm/discontig.c | 2 ++
arch/x86_64/mm/init.c | 6 +++---
drivers/acpi/numa.c | 4 ++--
mm/page_alloc.c | 30 +++++++++++++++---------------
mm/sparse.c | 12 +++++++-----
5 files changed, 29 insertions(+), 25 deletions(-)
Index: meminit/mm/sparse.c
===================================================================
--- meminit.orig/mm/sparse.c 2007-04-04 20:15:58.000000000 +0900
+++ meminit/mm/sparse.c 2007-04-04 20:55:44.000000000 +0900
@@ -61,7 +61,7 @@ static struct mem_section *sparse_index_
return section;
}
-static int sparse_index_init(unsigned long section_nr, int nid)
+static int __meminit sparse_index_init(unsigned long section_nr, int nid)
{
static DEFINE_SPINLOCK(index_init_lock);
unsigned long root = SECTION_NR_TO_ROOT(section_nr);
@@ -138,7 +138,7 @@ static inline int sparse_early_nid(struc
}
/* Record a memory area against a node. */
-void memory_present(int nid, unsigned long start, unsigned long end)
+void __init memory_present(int nid, unsigned long start, unsigned long end)
{
unsigned long pfn;
@@ -197,7 +197,7 @@ struct page *sparse_decode_mem_map(unsig
return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum);
}
-static int sparse_init_one_section(struct mem_section *ms,
+static int __meminit sparse_init_one_section(struct mem_section *ms,
unsigned long pnum, struct page *mem_map,
unsigned long *pageblock_bitmap)
{
@@ -211,7 +211,7 @@ static int sparse_init_one_section(struc
return 1;
}
-static struct page *sparse_early_mem_map_alloc(unsigned long pnum)
+static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
{
struct page *map;
struct mem_section *ms = __nr_to_section(pnum);
@@ -301,7 +301,7 @@ static unsigned long *sparse_early_usema
* Allocate the accumulated non-linear sections, allocate a mem_map
* for each and record the physical to section mapping.
*/
-void sparse_init(void)
+void __init sparse_init(void)
{
unsigned long pnum;
struct page *map;
@@ -324,6 +324,7 @@ void sparse_init(void)
}
}
+#ifdef CONFIG_MEMORY_HOTPLUG
/*
* returns the number of sections whose mem_maps were properly
* set. If this is <=0, then that means that the passed-in
@@ -370,3 +371,4 @@ out:
__kfree_section_memmap(memmap, nr_pages);
return ret;
}
+#endif
Index: meminit/arch/ia64/mm/discontig.c
===================================================================
--- meminit.orig/arch/ia64/mm/discontig.c 2007-04-04 20:15:58.000000000 +0900
+++ meminit/arch/ia64/mm/discontig.c 2007-04-04 20:16:02.000000000 +0900
@@ -696,6 +696,7 @@ void __init paging_init(void)
zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
}
+#ifdef CONFIG_MEMORY_HOTPLUG
pg_data_t *arch_alloc_nodedata(int nid)
{
unsigned long size = compute_pernodesize(nid);
@@ -713,3 +714,4 @@ void arch_refresh_nodedata(int update_no
pgdat_list[update_node] = update_pgdat;
scatter_node_data();
}
+#endif
Index: meminit/mm/page_alloc.c
===================================================================
--- meminit.orig/mm/page_alloc.c 2007-04-04 20:15:58.000000000 +0900
+++ meminit/mm/page_alloc.c 2007-04-04 20:55:44.000000000 +0900
@@ -105,7 +105,7 @@ int min_free_kbytes = 1024;
unsigned long __meminitdata nr_kernel_pages;
unsigned long __meminitdata nr_all_pages;
-static unsigned long __initdata dma_reserve;
+static unsigned long __meminitdata dma_reserve;
#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
/*
@@ -128,16 +128,16 @@ static unsigned long __initdata dma_rese
#endif
#endif
- struct node_active_region __initdata early_node_map[MAX_ACTIVE_REGIONS];
- int __initdata nr_nodemap_entries;
- unsigned long __initdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
- unsigned long __initdata arch_zone_highest_possible_pfn[MAX_NR_ZONES];
+ struct node_active_region __meminitdata early_node_map[MAX_ACTIVE_REGIONS];
+ int __meminitdata nr_nodemap_entries;
+ unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
+ unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES];
#ifdef CONFIG_MEMORY_HOTPLUG_RESERVE
unsigned long __initdata node_boundary_start_pfn[MAX_NUMNODES];
unsigned long __initdata node_boundary_end_pfn[MAX_NUMNODES];
#endif /* CONFIG_MEMORY_HOTPLUG_RESERVE */
unsigned long __initdata required_kernelcore;
- unsigned long __initdata zone_movable_pfn[MAX_NUMNODES];
+ unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES];
/* movable_zone is the "real" zone pages in ZONE_MOVABLE are taken from */
int movable_zone;
@@ -2755,7 +2755,7 @@ __meminit int init_currently_empty_zone(
* Basic iterator support. Return the first range of PFNs for a node
* Note: nid == MAX_NUMNODES returns first region regardless of node
*/
-static int __init first_active_region_index_in_nid(int nid)
+static int __meminit first_active_region_index_in_nid(int nid)
{
int i;
@@ -2770,7 +2770,7 @@ static int __init first_active_region_in
* Basic iterator support. Return the next active range of PFNs for a node
* Note: nid == MAX_NUMNODES returns next region regardles of node
*/
-static int __init next_active_region_index_in_nid(int index, int nid)
+static int __meminit next_active_region_index_in_nid(int index, int nid)
{
for (index = index + 1; index < nr_nodemap_entries; index++)
if (nid == MAX_NUMNODES || early_node_map[index].nid == nid)
@@ -2923,7 +2923,7 @@ static void __init account_node_boundary
* with no available memory, a warning is printed and the start and end
* PFNs will be 0.
*/
-void __init get_pfn_range_for_nid(unsigned int nid,
+void __meminit get_pfn_range_for_nid(unsigned int nid,
unsigned long *start_pfn, unsigned long *end_pfn)
{
int i;
@@ -2975,7 +2975,7 @@ void __init find_usable_zone_for_movable
* highest usable zone for ZONE_MOVABLE. This preserves the assumption that
* zones within a node are in order of monotonic increases memory addresses
*/
-void __init adjust_zone_range_for_zone_movable(int nid,
+void __meminit adjust_zone_range_for_zone_movable(int nid,
unsigned long zone_type,
unsigned long node_start_pfn,
unsigned long node_end_pfn,
@@ -3005,7 +3005,7 @@ void __init adjust_zone_range_for_zone_m
* Return the number of pages a zone spans in a node, including holes
* present_pages = zone_spanned_pages_in_node() - zone_absent_pages_in_node()
*/
-unsigned long __init zone_spanned_pages_in_node(int nid,
+unsigned long __meminit zone_spanned_pages_in_node(int nid,
unsigned long zone_type,
unsigned long *ignored)
{
@@ -3036,7 +3036,7 @@ unsigned long __init zone_spanned_pages_
* Return the number of holes in a range on a node. If nid is MAX_NUMNODES,
* then all holes in the requested range will be accounted for.
*/
-unsigned long __init __absent_pages_in_range(int nid,
+unsigned long __meminit __absent_pages_in_range(int nid,
unsigned long range_start_pfn,
unsigned long range_end_pfn)
{
@@ -3096,7 +3096,7 @@ unsigned long __init absent_pages_in_ran
}
/* Return the number of page frames in holes in a zone on a node */
-unsigned long __init zone_absent_pages_in_node(int nid,
+unsigned long __meminit zone_absent_pages_in_node(int nid,
unsigned long zone_type,
unsigned long *ignored)
{
@@ -3135,7 +3135,7 @@ static inline unsigned long zone_absent_
#endif
-static void __init calculate_node_totalpages(struct pglist_data *pgdat,
+static void __meminit calculate_node_totalpages(struct pglist_data *pgdat,
unsigned long *zones_size, unsigned long *zholes_size)
{
unsigned long realtotalpages, totalpages = 0;
@@ -3279,7 +3279,7 @@ static void __meminit free_area_init_cor
}
}
-static void __init alloc_node_mem_map(struct pglist_data *pgdat)
+static void __meminit alloc_node_mem_map(struct pglist_data *pgdat)
{
/* Skip empty nodes */
if (!pgdat->node_spanned_pages)
Index: meminit/drivers/acpi/numa.c
===================================================================
--- meminit.orig/drivers/acpi/numa.c 2007-04-04 20:15:58.000000000 +0900
+++ meminit/drivers/acpi/numa.c 2007-04-04 20:56:34.000000000 +0900
@@ -228,7 +228,7 @@ int __init acpi_numa_init(void)
return 0;
}
-int acpi_get_pxm(acpi_handle h)
+int __meminit acpi_get_pxm(acpi_handle h)
{
unsigned long pxm;
acpi_status status;
@@ -246,7 +246,7 @@ int acpi_get_pxm(acpi_handle h)
}
EXPORT_SYMBOL(acpi_get_pxm);
-int acpi_get_node(acpi_handle *handle)
+int __meminit acpi_get_node(acpi_handle *handle)
{
int pxm, node = -1;
Index: meminit/arch/x86_64/mm/init.c
===================================================================
--- meminit.orig/arch/x86_64/mm/init.c 2007-04-04 20:15:58.000000000 +0900
+++ meminit/arch/x86_64/mm/init.c 2007-04-04 20:20:17.000000000 +0900
@@ -173,7 +173,7 @@ __set_fixmap (enum fixed_addresses idx,
set_pte_phys(address, phys, prot);
}
-unsigned long __initdata table_start, table_end;
+unsigned long __meminitdata table_start, table_end;
static __meminit void *alloc_low_page(unsigned long *phys)
{
@@ -205,7 +205,7 @@ static __meminit void unmap_low_page(voi
}
/* Must run before zap_low_mappings */
-__init void *early_ioremap(unsigned long addr, unsigned long size)
+__meminit void *early_ioremap(unsigned long addr, unsigned long size)
{
unsigned long vaddr;
pmd_t *pmd, *last_pmd;
@@ -234,7 +234,7 @@ __init void *early_ioremap(unsigned long
}
/* To avoid virtual aliases later */
-__init void early_iounmap(void *addr, unsigned long size)
+__meminit void early_iounmap(void *addr, unsigned long size)
{
unsigned long vaddr;
pmd_t *pmd;
--
Yasunori Goto
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch] Fix section mismatch of memory hotplug related code.
2007-04-05 8:01 [Patch] Fix section mismatch of memory hotplug related code Yasunori Goto
@ 2007-05-05 0:04 ` Andrew Morton
2007-05-06 17:53 ` Sam Ravnborg
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2007-05-05 0:04 UTC (permalink / raw)
To: Yasunori Goto; +Cc: Linux Kernel ML, Miles Lane, Sam Ravnborg
On Thu, 05 Apr 2007 17:01:02 +0900
Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> Hello.
>
> This is to fix many section mismatches of code related to memory hotplug.
> I checked compile with memory hotplug on/off on ia64 and x86-64 box.
>
> ..
>
> ===================================================================
> --- meminit.orig/drivers/acpi/numa.c 2007-04-04 20:15:58.000000000 +0900
> +++ meminit/drivers/acpi/numa.c 2007-04-04 20:56:34.000000000 +0900
> @@ -228,7 +228,7 @@ int __init acpi_numa_init(void)
> return 0;
> }
>
> -int acpi_get_pxm(acpi_handle h)
> +int __meminit acpi_get_pxm(acpi_handle h)
> {
> unsigned long pxm;
> acpi_status status;
> @@ -246,7 +246,7 @@ int acpi_get_pxm(acpi_handle h)
> }
> EXPORT_SYMBOL(acpi_get_pxm);
>
> -int acpi_get_node(acpi_handle *handle)
> +int __meminit acpi_get_node(acpi_handle *handle)
> {
> int pxm, node = -1;
It doesn't make a lot of sense to export an __init symbol to modules. I
guess it's OK in this case, but we get warnings:
WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:acpi_get_node from __ksymtab between '__ksymtab_acpi_get_node' (at offset 0x1040) and '__ksymtab_acpi_get_pxm'
WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:acpi_get_pxm from __ksymtab between '__ksymtab_acpi_get_pxm' (at offset 0x1050) and '__ksymtab_acpi_unlock_battery_dir'
One fix would be to statically link them again. Another fix would be to
wrap the exports in #ifdef CONFIG_ACPI_HOTPLUG_MEMORY_MODULE. Neither is
very attractive.
Coold you have a think about it please? The config is at
http://userweb.kernel.org/~akpm/config-akpm2.txt
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch] Fix section mismatch of memory hotplug related code.
2007-05-05 0:04 ` Andrew Morton
@ 2007-05-06 17:53 ` Sam Ravnborg
2007-05-07 13:16 ` Yasunori Goto
2007-05-08 12:06 ` [Patch] Fix unnecesary meminit Yasunori Goto
0 siblings, 2 replies; 5+ messages in thread
From: Sam Ravnborg @ 2007-05-06 17:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: Yasunori Goto, Linux Kernel ML, Miles Lane
On Fri, May 04, 2007 at 05:04:21PM -0700, Andrew Morton wrote:
> On Thu, 05 Apr 2007 17:01:02 +0900
> Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
> > Hello.
> >
> > This is to fix many section mismatches of code related to memory hotplug.
> > I checked compile with memory hotplug on/off on ia64 and x86-64 box.
> >
> > ..
> >
> > ===================================================================
> > --- meminit.orig/drivers/acpi/numa.c 2007-04-04 20:15:58.000000000 +0900
> > +++ meminit/drivers/acpi/numa.c 2007-04-04 20:56:34.000000000 +0900
> > @@ -228,7 +228,7 @@ int __init acpi_numa_init(void)
> > return 0;
> > }
> >
> > -int acpi_get_pxm(acpi_handle h)
> > +int __meminit acpi_get_pxm(acpi_handle h)
> > {
> > unsigned long pxm;
> > acpi_status status;
> > @@ -246,7 +246,7 @@ int acpi_get_pxm(acpi_handle h)
> > }
> > EXPORT_SYMBOL(acpi_get_pxm);
> >
> > -int acpi_get_node(acpi_handle *handle)
> > +int __meminit acpi_get_node(acpi_handle *handle)
> > {
> > int pxm, node = -1;
>
> It doesn't make a lot of sense to export an __init symbol to modules. I
> guess it's OK in this case, but we get warnings:
It seems wrong to me to first tell linker to discard the code after init and
next to export the symbol to make it available for any module anytime.
Both function are relatively small so better avoid playing games and
drop the __meminit tag.
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch] Fix section mismatch of memory hotplug related code.
2007-05-06 17:53 ` Sam Ravnborg
@ 2007-05-07 13:16 ` Yasunori Goto
2007-05-08 12:06 ` [Patch] Fix unnecesary meminit Yasunori Goto
1 sibling, 0 replies; 5+ messages in thread
From: Yasunori Goto @ 2007-05-07 13:16 UTC (permalink / raw)
To: Sam Ravnborg, Andrew Morton; +Cc: Linux Kernel ML, Miles Lane
> On Fri, May 04, 2007 at 05:04:21PM -0700, Andrew Morton wrote:
> > On Thu, 05 Apr 2007 17:01:02 +0900
> > Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >
> > > Hello.
> > >
> > > This is to fix many section mismatches of code related to memory hotplug.
> > > I checked compile with memory hotplug on/off on ia64 and x86-64 box.
> > >
> > > ..
> > >
> > > ===================================================================
> > > --- meminit.orig/drivers/acpi/numa.c 2007-04-04 20:15:58.000000000 +0900
> > > +++ meminit/drivers/acpi/numa.c 2007-04-04 20:56:34.000000000 +0900
> > > @@ -228,7 +228,7 @@ int __init acpi_numa_init(void)
> > > return 0;
> > > }
> > >
> > > -int acpi_get_pxm(acpi_handle h)
> > > +int __meminit acpi_get_pxm(acpi_handle h)
> > > {
> > > unsigned long pxm;
> > > acpi_status status;
> > > @@ -246,7 +246,7 @@ int acpi_get_pxm(acpi_handle h)
> > > }
> > > EXPORT_SYMBOL(acpi_get_pxm);
> > >
> > > -int acpi_get_node(acpi_handle *handle)
> > > +int __meminit acpi_get_node(acpi_handle *handle)
> > > {
> > > int pxm, node = -1;
> >
> > It doesn't make a lot of sense to export an __init symbol to modules. I
> > guess it's OK in this case, but we get warnings:
Oops, I might do unnecessary things. :(
>
> It seems wrong to me to first tell linker to discard the code after init and
> next to export the symbol to make it available for any module anytime.
>
> Both function are relatively small so better avoid playing games and
> drop the __meminit tag.
It sounds reasonable. I'll do it.
Thanks.
--
Yasunori Goto
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Patch] Fix unnecesary meminit
2007-05-06 17:53 ` Sam Ravnborg
2007-05-07 13:16 ` Yasunori Goto
@ 2007-05-08 12:06 ` Yasunori Goto
1 sibling, 0 replies; 5+ messages in thread
From: Yasunori Goto @ 2007-05-08 12:06 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel ML, Miles Lane, Sam Ravnborg
> > It doesn't make a lot of sense to export an __init symbol to modules. I
> > guess it's OK in this case, but we get warnings:
>
> It seems wrong to me to first tell linker to discard the code after init and
> next to export the symbol to make it available for any module anytime.
>
> Both function are relatively small so better avoid playing games and
> drop the __meminit tag.
Ok. This is the patch.
-------
This is to fix unnecessary __meminit definition.
These are exported for kernel modules.
I compiled on ia64/x86-64 with memory hotplug on/off.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
drivers/acpi/numa.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.21-mm1/drivers/acpi/numa.c
===================================================================
--- linux-2.6.21-mm1.orig/drivers/acpi/numa.c 2007-05-08 19:33:05.000000000 +0900
+++ linux-2.6.21-mm1/drivers/acpi/numa.c 2007-05-08 19:33:12.000000000 +0900
@@ -228,7 +228,7 @@ int __init acpi_numa_init(void)
return 0;
}
-int __meminit acpi_get_pxm(acpi_handle h)
+int acpi_get_pxm(acpi_handle h)
{
unsigned long pxm;
acpi_status status;
@@ -246,7 +246,7 @@ int __meminit acpi_get_pxm(acpi_handle h
}
EXPORT_SYMBOL(acpi_get_pxm);
-int __meminit acpi_get_node(acpi_handle *handle)
+int acpi_get_node(acpi_handle *handle)
{
int pxm, node = -1;
--
Yasunori Goto
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-05-08 12:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-05 8:01 [Patch] Fix section mismatch of memory hotplug related code Yasunori Goto
2007-05-05 0:04 ` Andrew Morton
2007-05-06 17:53 ` Sam Ravnborg
2007-05-07 13:16 ` Yasunori Goto
2007-05-08 12:06 ` [Patch] Fix unnecesary meminit Yasunori Goto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome