linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Suren Baghdasaryan <surenb@google.com>, akpm@linux-foundation.org
Cc: kent.overstreet@linux.dev, pasha.tatashin@soleen.com,
	keescook@chromium.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/1] lib/alloc_tag: do not register sysctl interface when CONFIG_SYSCTL=n
Date: Mon, 3 Jun 2024 11:32:39 +0200	[thread overview]
Message-ID: <618f3c36-9952-438b-94dc-e3cb4a8afc48@suse.cz> (raw)
In-Reply-To: <20240601233831.617124-1-surenb@google.com>

On 6/2/24 1:38 AM, Suren Baghdasaryan wrote:
> Memory allocation profiling is trying to register sysctl interface even
> when CONFIG_SYSCTL=n, resulting in proc_do_static_key() being undefined.
> Prevent that by skipping sysctl registration for such configurations.
> 
> Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202405280616.wcOGWJEj-lkp@intel.com/
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> Cc: Kent Overstreet <kent.overstreet@linux.dev>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  lib/alloc_tag.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
> index 11ed973ac359..c347b8b72d78 100644
> --- a/lib/alloc_tag.c
> +++ b/lib/alloc_tag.c
> @@ -227,6 +227,7 @@ struct page_ext_operations page_alloc_tagging_ops = {
>  };
>  EXPORT_SYMBOL(page_alloc_tagging_ops);
>  
> +#ifdef CONFIG_SYSCTL
>  static struct ctl_table memory_allocation_profiling_sysctls[] = {
>  	{
>  		.procname	= "mem_profiling",
> @@ -241,6 +242,17 @@ static struct ctl_table memory_allocation_profiling_sysctls[] = {
>  	{ }
>  };
>  
> +static void __init sysctl_init(void)
> +{
> +	if (!mem_profiling_support)
> +		memory_allocation_profiling_sysctls[0].mode = 0444;
> +
> +	register_sysctl_init("vm", memory_allocation_profiling_sysctls);
> +}
> +#else /* CONFIG_SYSCTL */
> +static inline void sysctl_init(void) {}
> +#endif /* CONFIG_SYSCTL */
> +
>  static int __init alloc_tag_init(void)
>  {
>  	const struct codetag_type_desc desc = {
> @@ -253,9 +265,7 @@ static int __init alloc_tag_init(void)
>  	if (IS_ERR(alloc_tag_cttype))
>  		return PTR_ERR(alloc_tag_cttype);
>  
> -	if (!mem_profiling_support)
> -		memory_allocation_profiling_sysctls[0].mode = 0444;
> -	register_sysctl_init("vm", memory_allocation_profiling_sysctls);
> +	sysctl_init();
>  	procfs_init();
>  
>  	return 0;
> 
> base-commit: 065d3634d60843b8e338d405b844cc7f2e5e1c66



      reply	other threads:[~2024-06-03  9:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01 23:38 Suren Baghdasaryan
2024-06-03  9:32 ` Vlastimil Babka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=618f3c36-9952-438b-94dc-e3cb4a8afc48@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox