linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Casey Chen <cachen@purestorage.com>
Cc: linux-mm@kvack.org, kent.overstreet@linux.dev, yzhong@purestorage.com
Subject: Re: [PATCH v2] alloc_tag: check mem_profiling_support in alloc_tag_init
Date: Fri, 9 May 2025 09:11:59 -0700	[thread overview]
Message-ID: <CAJuCfpHnYtx7BUEyN8P=6h9MXCiuWVZ4NYzpyw1V+oh1e_8Dzg@mail.gmail.com> (raw)
In-Reply-To: <20250508234742.93114-1-cachen@purestorage.com>

On Thu, May 8, 2025 at 4:47 PM Casey Chen <cachen@purestorage.com> wrote:
>
> Allocate module tags and register codetag type only when
> mem_profiling_support is true. If it is set as false,
> for example by sysctl.vm.mem_profiling=never, skip them.
>
> Signed-off-by: Casey Chen <cachen@purestorage.com>
> Reviewed-by: Yuanyuan Zhong <yzhong@purestorage.com>

Thanks! Looks good to me but let me take a closer look over the
weekend to make sure we do not break anything by skipping this
allocation.

> ---
>  lib/alloc_tag.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
> index 25ecc1334b67..fbf128072c7e 100644
> --- a/lib/alloc_tag.c
> +++ b/lib/alloc_tag.c
> @@ -762,14 +762,16 @@ static int __init alloc_tag_init(void)
>         };
>         int res;
>
> -       res = alloc_mod_tags_mem();
> -       if (res)
> -               return res;
> -
> -       alloc_tag_cttype = codetag_register_type(&desc);
> -       if (IS_ERR(alloc_tag_cttype)) {
> -               free_mod_tags_mem();
> -               return PTR_ERR(alloc_tag_cttype);
> +       if (mem_profiling_support) {
> +               res = alloc_mod_tags_mem();
> +               if (res)
> +                       return res;
> +
> +               alloc_tag_cttype = codetag_register_type(&desc);
> +               if (IS_ERR(alloc_tag_cttype)) {
> +                       free_mod_tags_mem();
> +                       return PTR_ERR(alloc_tag_cttype);
> +               }
>         }
>
>         sysctl_init();
> --
> 2.49.0
>


  reply	other threads:[~2025-05-09 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 23:47 Casey Chen
2025-05-09 16:11 ` Suren Baghdasaryan [this message]
2025-05-12 16:48   ` Suren Baghdasaryan

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='CAJuCfpHnYtx7BUEyN8P=6h9MXCiuWVZ4NYzpyw1V+oh1e_8Dzg@mail.gmail.com' \
    --to=surenb@google.com \
    --cc=cachen@purestorage.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=yzhong@purestorage.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