All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] mm: make alloc_node_mem_map a voidcall if we don't have CONFIG_FLAT_NODE_MEM_MAP
@ 2017-11-14 11:19 Oscar Salvador
  2017-11-14 11:53 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Oscar Salvador @ 2017-11-14 11:19 UTC (permalink / raw)
  To: linux-mm; +Cc: mhocko, mgorman, vbabka

free_area_init_node() calls alloc_node_mem_map(), but this function
does nothing unless we have CONFIG_FLAT_NODE_MEM_MAP.

As a cleanup, we can move the "#ifdef CONFIG_FLAT_NODE_MEM_MAP" within
alloc_node_mem_map() out of the function, and define a
alloc_node_mem_map() { } when CONFIG_FLAT_NODE_MEM_MAP is not present.

This also moves the printk, that lays within the "#ifdef CONFIG_FLAT_NODE_MEM_MAP" block,
from free_area_init_node() to alloc_node_mem_map(), getting rid of the
"#ifdef CONFIG_FLAT_NODE_MEM_MAP" in free_area_init_node().

Signed-off-by: Oscar Salvador <osalvador@techadventures.net>
---
 mm/page_alloc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 77e4d3c5c57b..56400b5d3183 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6126,6 +6126,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
 	}
 }
 
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
 static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
 {
 	unsigned long __maybe_unused start = 0;
@@ -6135,7 +6136,6 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
 	if (!pgdat->node_spanned_pages)
 		return;
 
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
 	start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
 	offset = pgdat->node_start_pfn - start;
 	/* ia64 gets its own node_mem_map, before this, without bootmem */
@@ -6157,6 +6157,9 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
 							       pgdat->node_id);
 		pgdat->node_mem_map = map + offset;
 	}
+	printk(KERN_DEBUG "alloc_node_mem_map: node %d, pgdat %08lx, node_mem_map %08lx\n",
+							pgdat->node_id, (unsigned long)pgdat,
+							(unsigned long)pgdat->node_mem_map);
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 	/*
 	 * With no DISCONTIG, the global mem_map is just set as node 0's
@@ -6169,8 +6172,10 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
 #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
 	}
 #endif
-#endif /* CONFIG_FLAT_NODE_MEM_MAP */
 }
+#else
+static void __ref alloc_node_mem_map(struct pglist_data *pgdat) { }
+#endif /* CONFIG_FLAT_NODE_MEM_MAP */
 
 void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
 		unsigned long node_start_pfn, unsigned long *zholes_size)
@@ -6197,11 +6202,6 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
 				  zones_size, zholes_size);
 
 	alloc_node_mem_map(pgdat);
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
-	printk(KERN_DEBUG "free_area_init_node: node %d, pgdat %08lx, node_mem_map %08lx\n",
-		nid, (unsigned long)pgdat,
-		(unsigned long)pgdat->node_mem_map);
-#endif
 
 	reset_deferred_meminit(pgdat);
 	free_area_init_core(pgdat);
-- 
2.13.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] mm: make alloc_node_mem_map a voidcall if we don't have CONFIG_FLAT_NODE_MEM_MAP
  2017-11-14 11:19 [PATCH v1] mm: make alloc_node_mem_map a voidcall if we don't have CONFIG_FLAT_NODE_MEM_MAP Oscar Salvador
@ 2017-11-14 11:53 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2017-11-14 11:53 UTC (permalink / raw)
  To: Oscar Salvador; +Cc: linux-mm, mgorman, vbabka, Andrew Morton

Cc Andrew

On Tue 14-11-17 12:19:35, Oscar Salvador wrote:
> free_area_init_node() calls alloc_node_mem_map(), but this function
> does nothing unless we have CONFIG_FLAT_NODE_MEM_MAP.
> 
> As a cleanup, we can move the "#ifdef CONFIG_FLAT_NODE_MEM_MAP" within
> alloc_node_mem_map() out of the function, and define a
> alloc_node_mem_map() { } when CONFIG_FLAT_NODE_MEM_MAP is not present.
> 
> This also moves the printk, that lays within the "#ifdef CONFIG_FLAT_NODE_MEM_MAP" block,
> from free_area_init_node() to alloc_node_mem_map(), getting rid of the
> "#ifdef CONFIG_FLAT_NODE_MEM_MAP" in free_area_init_node().
> 
> Signed-off-by: Oscar Salvador <osalvador@techadventures.net>

Yes, this looks like a nice cleanup even though it doesn't really remove
any code. The ifdef mess in alloc_node_mem_map is just too awful to live

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/page_alloc.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 77e4d3c5c57b..56400b5d3183 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6126,6 +6126,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
>  	}
>  }
>  
> +#ifdef CONFIG_FLAT_NODE_MEM_MAP
>  static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
>  {
>  	unsigned long __maybe_unused start = 0;
> @@ -6135,7 +6136,6 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
>  	if (!pgdat->node_spanned_pages)
>  		return;
>  
> -#ifdef CONFIG_FLAT_NODE_MEM_MAP
>  	start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
>  	offset = pgdat->node_start_pfn - start;
>  	/* ia64 gets its own node_mem_map, before this, without bootmem */
> @@ -6157,6 +6157,9 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
>  							       pgdat->node_id);
>  		pgdat->node_mem_map = map + offset;
>  	}
> +	printk(KERN_DEBUG "alloc_node_mem_map: node %d, pgdat %08lx, node_mem_map %08lx\n",
> +							pgdat->node_id, (unsigned long)pgdat,
> +							(unsigned long)pgdat->node_mem_map);
>  #ifndef CONFIG_NEED_MULTIPLE_NODES
>  	/*
>  	 * With no DISCONTIG, the global mem_map is just set as node 0's
> @@ -6169,8 +6172,10 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
>  #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>  	}
>  #endif
> -#endif /* CONFIG_FLAT_NODE_MEM_MAP */
>  }
> +#else
> +static void __ref alloc_node_mem_map(struct pglist_data *pgdat) { }
> +#endif /* CONFIG_FLAT_NODE_MEM_MAP */
>  
>  void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
>  		unsigned long node_start_pfn, unsigned long *zholes_size)
> @@ -6197,11 +6202,6 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
>  				  zones_size, zholes_size);
>  
>  	alloc_node_mem_map(pgdat);
> -#ifdef CONFIG_FLAT_NODE_MEM_MAP
> -	printk(KERN_DEBUG "free_area_init_node: node %d, pgdat %08lx, node_mem_map %08lx\n",
> -		nid, (unsigned long)pgdat,
> -		(unsigned long)pgdat->node_mem_map);
> -#endif
>  
>  	reset_deferred_meminit(pgdat);
>  	free_area_init_core(pgdat);
> -- 
> 2.13.5
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-14 11:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 11:19 [PATCH v1] mm: make alloc_node_mem_map a voidcall if we don't have CONFIG_FLAT_NODE_MEM_MAP Oscar Salvador
2017-11-14 11:53 ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.