memory-failure: fix section mismatch
Subsystems (2)
PATCH 1/1 memory-failure: fix section mismatch
Clang complains when a variable is declared extern twice, but with two different sections. num_poisoned_pages is marked extern and __read_mostly in include/linux/swapops.h, but only extern in include/linux/mm.h. Some c source files must include both, and thus see the conflicting declarations.
--- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mm.h +1 -1
@@ -2582,7 +2582,7 @@ extern int get_hwpoison_page(struct page *page);extern int sysctl_memory_failure_early_kill;extern int sysctl_memory_failure_recovery;extern void shake_page (struct page *p,int access); -extern atomic_long_t num_poisoned_pages; +extern atomic_long_t num_poisoned_pages__read_mostly ;extern int soft_offline_page (struct page *page,int flags);
Signature · 7 lines
2.14.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 5 lines · Nick Desaulniers
Clang complains when a variable is declared extern twice, but with two different sections.
num_poisoned_pagesis marked extern and__read_mostlyininclude/linux/swapops.h, but only extern ininclude/linux/mm.h. Some c source files must include both, and thus see the conflicting declarations.
Why do we need declarations in both places? This sounds like a mess to me.
Quoted 21 lines
Signed-off-by Nick Desaulniers <[email protected]>--- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/mm.h +1
-1@@ -2582,7 +2582,7 @@ extern int get_hwpoison_page(struct page *page);extern int sysctl_memory_failure_early_kill;extern int sysctl_memory_failure_recovery;extern void shake_page (struct page *p,int access); -extern atomic_long_t num_poisoned_pages; +extern atomic_long_t num_poisoned_pages__read_mostly ;extern int soft_offline_page (struct page *page,int flags);Signature · 1 line
2.14.1
Signature · 2 lines
Michal Hocko SUSE Labs
El Sat, Mar 03, 2018 at 11:16:11PM -0800 Nick Desaulniers ha dit:
Quoted 16 lines
Clang complains when a variable is declared extern twice, but with two different sections.
num_poisoned_pagesis marked extern and__read_mostlyininclude/linux/swapops.h, but only extern ininclude/linux/mm.h. Some c source files must include both, and thus see the conflicting declarations.Signed-off-by Nick Desaulniers <[email protected]>--- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/mm.h +0
-0
include/linux/mm.h extern int get_hwpoison_page(struct page *page); · line 2586
Quoted 6 lines
include/linux/mm.h +1
-1@@ -2582,7 +2582,7 @@ extern int get_hwpoison_page(struct page *page);extern int sysctl_memory_failure_early_kill;extern int sysctl_memory_failure_recovery;extern void shake_page (struct page *p,int access); -extern atomic_long_t num_poisoned_pages; +extern atomic_long_t num_poisoned_pages__read_mostly ;extern int soft_offline_page (struct page *page,int flags);
An equivalent patch was posted by Guenter Roeck and has been picked up by Andrew: https://patchwork.kernel.org/patch/10243919/