linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section
@ 2025-03-19  6:00 marc.herbert
  2025-03-19  6:27 ` Anshuman Khandual
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: marc.herbert @ 2025-03-19  6:00 UTC (permalink / raw)
  To: marc.herbert
  Cc: Muchun Song, Andrew Morton, linux-mm, linux-kernel, Marc Herbert

From: Marc Herbert <Marc.Herbert@linux.intel.com>

hugetlb_sysctl_init() is only invoked once by an __init function and is
merely a wrapper around another __init function so there is not reason
to keep it.

Fixes the following warning when toning down some GCC inline options:

 WARNING: modpost: vmlinux: section mismatch in reference:
   hugetlb_sysctl_init+0x1b (section: .text) ->
     __register_sysctl_init (section: .init.text)

Signed-off-by: Marc Herbert <Marc.Herbert@linux.intel.com>
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 65068671e460..a2850b26aed9 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4900,7 +4900,7 @@ static const struct ctl_table hugetlb_table[] = {
 	},
 };
 
-static void hugetlb_sysctl_init(void)
+static void __init hugetlb_sysctl_init(void)
 {
 	register_sysctl_init("vm", hugetlb_table);
 }
-- 
2.48.1



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

* Re: [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section
  2025-03-19  6:00 [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section marc.herbert
@ 2025-03-19  6:27 ` Anshuman Khandual
  2025-03-19  7:22 ` Andrew Morton
  2025-03-19  7:44 ` Muchun Song
  2 siblings, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2025-03-19  6:27 UTC (permalink / raw)
  To: marc.herbert; +Cc: Muchun Song, Andrew Morton, linux-mm, linux-kernel


On 3/19/25 11:30, marc.herbert@linux.intel.com wrote:
> From: Marc Herbert <Marc.Herbert@linux.intel.com>
> 
> hugetlb_sysctl_init() is only invoked once by an __init function and is
> merely a wrapper around another __init function so there is not reason
> to keep it.
> 
> Fixes the following warning when toning down some GCC inline options:
> 
>  WARNING: modpost: vmlinux: section mismatch in reference:
>    hugetlb_sysctl_init+0x1b (section: .text) ->
>      __register_sysctl_init (section: .init.text)
> 
> Signed-off-by: Marc Herbert <Marc.Herbert@linux.intel.com>
> ---
>  mm/hugetlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 65068671e460..a2850b26aed9 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4900,7 +4900,7 @@ static const struct ctl_table hugetlb_table[] = {
>  	},
>  };
>  
> -static void hugetlb_sysctl_init(void)
> +static void __init hugetlb_sysctl_init(void)
>  {
>  	register_sysctl_init("vm", hugetlb_table);
>  }

LGTM

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>


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

* Re: [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section
  2025-03-19  6:00 [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section marc.herbert
  2025-03-19  6:27 ` Anshuman Khandual
@ 2025-03-19  7:22 ` Andrew Morton
  2025-03-20 17:31   ` Marc Herbert
  2025-03-19  7:44 ` Muchun Song
  2 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2025-03-19  7:22 UTC (permalink / raw)
  To: marc.herbert; +Cc: Muchun Song, linux-mm, linux-kernel, Marc Herbert

On Wed, 19 Mar 2025 06:00:30 +0000 marc.herbert@linux.intel.com wrote:

> From: Marc Herbert <Marc.Herbert@linux.intel.com>
> 
> hugetlb_sysctl_init() is only invoked once by an __init function and is
> merely a wrapper around another __init function so there is not reason
> to keep it.
> 
> Fixes the following warning when toning down some GCC inline options:
> 
>  WARNING: modpost: vmlinux: section mismatch in reference:
>    hugetlb_sysctl_init+0x1b (section: .text) ->
>      __register_sysctl_init (section: .init.text)
> 

Huh.  I wonder why this just started happening.


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

* Re: [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section
  2025-03-19  6:00 [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section marc.herbert
  2025-03-19  6:27 ` Anshuman Khandual
  2025-03-19  7:22 ` Andrew Morton
@ 2025-03-19  7:44 ` Muchun Song
  2 siblings, 0 replies; 5+ messages in thread
From: Muchun Song @ 2025-03-19  7:44 UTC (permalink / raw)
  To: marc.herbert; +Cc: Andrew Morton, linux-mm, linux-kernel



> On Mar 19, 2025, at 14:00, marc.herbert@linux.intel.com wrote:
> 
> From: Marc Herbert <Marc.Herbert@linux.intel.com>
> 
> hugetlb_sysctl_init() is only invoked once by an __init function and is
> merely a wrapper around another __init function so there is not reason
> to keep it.
> 
> Fixes the following warning when toning down some GCC inline options:
> 
> WARNING: modpost: vmlinux: section mismatch in reference:
>   hugetlb_sysctl_init+0x1b (section: .text) ->
>     __register_sysctl_init (section: .init.text)
> 
> Signed-off-by: Marc Herbert <Marc.Herbert@linux.intel.com>

Reviewed-by: Muchun Song <muchun.song@linux.dev>

Thanks.



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

* Re: [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section
  2025-03-19  7:22 ` Andrew Morton
@ 2025-03-20 17:31   ` Marc Herbert
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Herbert @ 2025-03-20 17:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Muchun Song, linux-mm, linux-kernel

Hi Andrew,

On 2025-03-19 00:22, Andrew Morton wrote:
> On Wed, 19 Mar 2025 06:00:30 +0000 marc.herbert@linux.intel.com wrote:
> 
>> hugetlb_sysctl_init() is only invoked once by an __init function and is
>> merely a wrapper around another __init function so there is not reason
>> to keep it.
>>
>> Fixes the following warning when toning down some GCC inline options:
>>
>>  WARNING: modpost: vmlinux: section mismatch in reference:
>>    hugetlb_sysctl_init+0x1b (section: .text) ->
>>      __register_sysctl_init (section: .init.text)
>>
> 
> Huh.  I wonder why this just started happening.

As I just mentioned, I see this warning only because I'm playing with
GCC flags.

Not sure how good is that page but its name is perfect here:
https://stackoverflow.com/questions/59388740/gcc-shows-different-warnings-depending-on-optimisation-level

Also, https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html
> The effectiveness of some warnings depends on optimizations also being
> enabled. For example -Wsuggest-final-types is more effective with
> link-time optimization and some instances of other warnings may not be
> issued at all unless optimization is enabled. While optimization in
> general improves the efficacy of control and data flow sensitive
> warnings, in some cases it may also cause false positives.

That particular warning was very minor but simple and valid; not a false 
positive. It was also the only "section mismatch" warning found in my
entire configuration.

Marc

PS: who needs expensive static analysis tools when unusual combination of
compiler flags can find issues? :-D


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

end of thread, other threads:[~2025-03-20 17:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-19  6:00 [PATCH] mm/hugetlb: move hugetlb_sysctl_init() to the __init section marc.herbert
2025-03-19  6:27 ` Anshuman Khandual
2025-03-19  7:22 ` Andrew Morton
2025-03-20 17:31   ` Marc Herbert
2025-03-19  7:44 ` Muchun Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox