Re: [PATCH] memory-failure: fix section mismatch

From: Michal Hocko
Date: Tue Mar 13 2018 - 10:45:43 EST


On Sat 03-03-18 23:16:11, Nick Desaulniers wrote:
> 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.

Why do we need declarations in both places? This sounds like a mess to
me.

> Signed-off-by: Nick Desaulniers <nick.desaulniers@xxxxxxxxx>
> ---
> include/linux/mm.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index ad06d42adb1a..bd4bd59f02c1 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -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);
>
>
> --
> 2.14.1
>

--
Michal Hocko
SUSE Labs