mm, sparse: Put clear_hwpoisoned_pages within CONFIG_MEMORY_HOTREMOVE
Subsystems (2)
PATCH 1/1 mm, sparse: Put clear_hwpoisoned_pages within CONFIG_MEMORY_HOTREMOVE
From: Zhang Yanfei <[email protected]>
With CONFIG_MEMORY_HOTREMOVE unset, there is a compile warning:
mm/sparse.c:755: warning: a??clear_hwpoisoned_pagesa?? defined but not used
And Bisecting it ended up pointing to:
commit 4edd7ceff0662afde195da6f6c43e7cbe1ed2dc4
Author: David Rientjes <[email protected]> Date: Mon Apr 29 15:08:22 2013 -0700
mm, hotplug: avoid compiling memory hotremove functions when disabled
__remove_pages() is only necessary for CONFIG_MEMORY_HOTREMOVE. PowerPC pseries will return -EOPNOTSUPP if unsupported.
Adding an #ifdef causes several other functions it depends on to also become unnecessary, which saves in .text when disabled (it's disabled in most defconfigs besides powerpc, including x86). remove_memory_block() becomes static since it is not referenced outside of drivers/base/memory.c.
Build tested on x86 and powerpc with CONFIG_MEMORY_HOTREMOVE both enabled and disabled.
This is because the commit above put function sparse_remove_one_section within the protection of CONFIG_MEMORY_HOTREMOVE but the only user of function clear_hwpoisoned_pages is sparse_remove_one_section, and it is not within the protection of CONFIG_MEMORY_HOTREMOVE.
So put clear_hwpoisoned_pages within CONFIG_MEMORY_HOTREMOVE should fix the warning.
--- mm/sparse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/sparse.c +1 -1
@@ -751,6 +751,7 @@ out:return ret; } +#ifdef CONFIG_MEMORY_HOTREMOVE #ifdef CONFIG_MEMORY_FAILURE static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) {
@@ -772,7 +773,6 @@ static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) }#endif -#ifdef CONFIG_MEMORY_HOTREMOVE static void free_section_usemap (struct page *memmap,unsigned long *usemap) {struct page *usemap_page;
Signature · 7 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 42 lines · Zhang Yanfei
From: Zhang Yanfei <[email protected]>
With
CONFIG_MEMORY_HOTREMOVEunset, there is a compile warning:
mm/sparse.c:755: warning: a??clear_hwpoisoned_pagesa?? defined but not usedAnd Bisecting it ended up pointing to:
commit
4edd7ceff0662afde195da6f6c43e7cbe1ed2dc4Author: David Rientjes <[email protected]> Date: Mon Apr 29 15:08:22 2013 -0700mm, hotplug: avoid compiling memory hotremove functions when disabled
__remove_pages()is only necessary forCONFIG_MEMORY_HOTREMOVE. PowerPC pseries will return-EOPNOTSUPPif unsupported.Adding an #ifdef causes several other functions it depends on to also become unnecessary, which saves in .text when disabled (it's disabled in most defconfigs besides powerpc, including x86).
remove_memory_block()becomes static since it is not referenced outside ofdrivers/base/memory.c.Build tested on x86 and powerpc with
CONFIG_MEMORY_HOTREMOVEboth enabled and disabled.Signed-off-by David Rientjes <[email protected]>Acked-by Toshi Kani <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Wen Congyang <[email protected]>Cc Tang Chen <[email protected]>Cc Yasuaki Ishimatsu <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>This is because the commit above put function
sparse_remove_one_sectionwithin the protection ofCONFIG_MEMORY_HOTREMOVEbut the only user of functionclear_hwpoisoned_pagesissparse_remove_one_section, and it is not within the protection ofCONFIG_MEMORY_HOTREMOVE.
Quoted 6 lines
So put
clear_hwpoisoned_pageswithinCONFIG_MEMORY_HOTREMOVEshould fix the warning.Signed-off-by Zhang Yanfei <[email protected]>Cc David Rientjes <[email protected]>Cc Toshi Kani <[email protected]>
Looks good.
Thanks,
-Toshi
Quoted 16 lines
mm/sparse.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)mm/sparse.c +1
-0@@ -751,6 +751,7 @@ out:return ret; } +#ifdef CONFIG_MEMORY_HOTREMOVE #ifdef CONFIG_MEMORY_FAILURE static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) {
mm/sparse.c static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) · line 778
Quoted 7 lines
mm/sparse.c +0
-1@@ -772,7 +773,6 @@ static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) }#endif -#ifdef CONFIG_MEMORY_HOTREMOVE static void free_section_usemap (struct page *memmap,unsigned long *usemap) {struct page *usemap_page;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>