linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] mm/page_alloc: fix gcc compile warning
  2019-10-23 13:48 [PATCH] mm/page_alloc: fix gcc compile warning Chen Wandun
@ 2019-10-23 13:44 ` David Hildenbrand
  2019-10-23 14:38 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2019-10-23 13:44 UTC (permalink / raw)
  To: Chen Wandun, akpm, mhocko, vbabka, osalvador, mgorman, rppt,
	dan.j.williams, alexander.h.duyck, anshuman.khandual,
	pavel.tatashin, linux-mm, linux-kernel

On 23.10.19 15:48, Chen Wandun wrote:
> From: Chenwandun <chenwandun@huawei.com>
> 
> mm/page_alloc.o: In function `page_alloc_init_late':
> mm/page_alloc.c:1956: undefined reference to `zone_pcp_update'
> mm/page_alloc.o:(.debug_addr+0x8350): undefined reference to `zone_pcp_update'
> make: *** [vmlinux] Error 1
> 
> zone_pcp_update is defined in CONFIG_MEMORY_HOTPLUG,
> so add ifdef when calling zone_pcp_update.
> 
> Signed-off-by: Chenwandun <chenwandun@huawei.com>
> ---
>  mm/page_alloc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f9488ef..8513150 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1952,8 +1952,10 @@ void __init page_alloc_init_late(void)
>  	 * so the pcpu batch and high limits needs to be updated or the limits
>  	 * will be artificially small.
>  	 */
> +#ifdef CONFIG_MEMORY_HOTPLUG
>  	for_each_populated_zone(zone)
>  		zone_pcp_update(zone);
> +#endif
>  
>  	/*
>  	 * We initialized the rest of the deferred pages.  Permanently disable
> 

See

https://lkml.org/lkml/2019/10/23/206

-- 

Thanks,

David / dhildenb


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

* [PATCH] mm/page_alloc: fix gcc compile warning
@ 2019-10-23 13:48 Chen Wandun
  2019-10-23 13:44 ` David Hildenbrand
  2019-10-23 14:38 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Wandun @ 2019-10-23 13:48 UTC (permalink / raw)
  To: akpm, mhocko, vbabka, osalvador, mgorman, rppt, dan.j.williams,
	alexander.h.duyck, anshuman.khandual, pavel.tatashin, linux-mm,
	linux-kernel
  Cc: chenwandun

From: Chenwandun <chenwandun@huawei.com>

mm/page_alloc.o: In function `page_alloc_init_late':
mm/page_alloc.c:1956: undefined reference to `zone_pcp_update'
mm/page_alloc.o:(.debug_addr+0x8350): undefined reference to `zone_pcp_update'
make: *** [vmlinux] Error 1

zone_pcp_update is defined in CONFIG_MEMORY_HOTPLUG,
so add ifdef when calling zone_pcp_update.

Signed-off-by: Chenwandun <chenwandun@huawei.com>
---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f9488ef..8513150 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1952,8 +1952,10 @@ void __init page_alloc_init_late(void)
 	 * so the pcpu batch and high limits needs to be updated or the limits
 	 * will be artificially small.
 	 */
+#ifdef CONFIG_MEMORY_HOTPLUG
 	for_each_populated_zone(zone)
 		zone_pcp_update(zone);
+#endif
 
 	/*
 	 * We initialized the rest of the deferred pages.  Permanently disable
-- 
2.7.4


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

* Re: [PATCH] mm/page_alloc: fix gcc compile warning
  2019-10-23 13:48 [PATCH] mm/page_alloc: fix gcc compile warning Chen Wandun
  2019-10-23 13:44 ` David Hildenbrand
@ 2019-10-23 14:38 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2019-10-23 14:38 UTC (permalink / raw)
  To: Chen Wandun
  Cc: akpm, vbabka, osalvador, mgorman, rppt, dan.j.williams,
	alexander.h.duyck, anshuman.khandual, pavel.tatashin, linux-mm,
	linux-kernel

On Wed 23-10-19 21:48:28, Chen Wandun wrote:
> From: Chenwandun <chenwandun@huawei.com>
> 
> mm/page_alloc.o: In function `page_alloc_init_late':
> mm/page_alloc.c:1956: undefined reference to `zone_pcp_update'
> mm/page_alloc.o:(.debug_addr+0x8350): undefined reference to `zone_pcp_update'
> make: *** [vmlinux] Error 1
> 
> zone_pcp_update is defined in CONFIG_MEMORY_HOTPLUG,
> so add ifdef when calling zone_pcp_update.

David has already pointed out that this has been fixed already but let
me note one more thing. This patch is wrong at two levels. The first one
that it simply does a wrong thing. The comment above the code explains
why zone_pcp_update is called and ifdef makes it depend on
MEMORY_HOTPLUG support which has nothing to do with that code.
The second problem and I find it as a reoccuring problem (and that's why
I am writing this reply) that the changelog explains what but it doesn't
say why. It would certainly be unsatisfactory to say "because compiler
complains". So there would have to be a clarification that
zone_pcp_update is only available for CONFIG_MEMORY_HOTPLUG and why the
code only applies to those configuration. That would be much harder to
justify because there is no real connection.

That being said, a proper changelog with a good explanation of what and
why can help to discover a wrong patch early.

> Signed-off-by: Chenwandun <chenwandun@huawei.com>
> ---
>  mm/page_alloc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f9488ef..8513150 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1952,8 +1952,10 @@ void __init page_alloc_init_late(void)
>  	 * so the pcpu batch and high limits needs to be updated or the limits
>  	 * will be artificially small.
>  	 */
> +#ifdef CONFIG_MEMORY_HOTPLUG
>  	for_each_populated_zone(zone)
>  		zone_pcp_update(zone);
> +#endif
>  
>  	/*
>  	 * We initialized the rest of the deferred pages.  Permanently disable
> -- 
> 2.7.4

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2019-10-23 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 13:48 [PATCH] mm/page_alloc: fix gcc compile warning Chen Wandun
2019-10-23 13:44 ` David Hildenbrand
2019-10-23 14:38 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).