diff mbox series

[1/3] mm: make memmap_init a proper function

Message ID 20180724235520.10200-2-pasha.tatashin@oracle.com (mailing list archive)
State New, archived
Headers show
Series memmap_init_zone improvements | expand

Commit Message

Pavel Tatashin July 24, 2018, 11:55 p.m. UTC
memmap_init is sometimes a macro sometimes a function based on
__HAVE_ARCH_MEMMAP_INIT. It is only a function on ia64. Make
memmap_init a weak function instead, and let ia64 redefine it.

Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
---
 arch/ia64/include/asm/pgtable.h | 1 -
 mm/page_alloc.c                 | 9 +++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Oscar Salvador July 26, 2018, 7:50 a.m. UTC | #1
On Tue, Jul 24, 2018 at 07:55:18PM -0400, Pavel Tatashin wrote:
> memmap_init is sometimes a macro sometimes a function based on
> __HAVE_ARCH_MEMMAP_INIT. It is only a function on ia64. Make
> memmap_init a weak function instead, and let ia64 redefine it.
> 
> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>

Looks good, and it is easier to read.

Reviewed-by: Oscar Salvador <osalvador@suse.de>

Thanks
diff mbox series

Patch

diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index 165827774bea..b1e7468eb65a 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -544,7 +544,6 @@  extern struct page *zero_page_memmap_ptr;
 
 #  ifdef CONFIG_VIRTUAL_MEM_MAP
   /* arch mem_map init routine is needed due to holes in a virtual mem_map */
-#   define __HAVE_ARCH_MEMMAP_INIT
     extern void memmap_init (unsigned long size, int nid, unsigned long zone,
 			     unsigned long start_pfn);
 #  endif /* CONFIG_VIRTUAL_MEM_MAP */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a790ef4be74e..cea749b26394 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5554,10 +5554,11 @@  static void __meminit zone_init_free_lists(struct zone *zone)
 	}
 }
 
-#ifndef __HAVE_ARCH_MEMMAP_INIT
-#define memmap_init(size, nid, zone, start_pfn) \
-	memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY, NULL)
-#endif
+void __meminit __weak memmap_init(unsigned long size, int nid,
+				  unsigned long zone, unsigned long start_pfn)
+{
+	memmap_init_zone(size, nid, zone, start_pfn, MEMMAP_EARLY, NULL);
+}
 
 static int zone_batchsize(struct zone *zone)
 {