The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Usama Arif <usamaarif642@gmail.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, hannes@cmpxchg.org, shakeel.butt@linux.dev,
	linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH] alloc_tag: introduce Kconfig option for default compressed profiling
Date: Thu, 17 Apr 2025 15:33:18 +0100	[thread overview]
Message-ID: <6305a60d-8bb1-4479-9111-86442c278e21@gmail.com> (raw)
In-Reply-To: <CAJuCfpED6HQh8mT-8tvKzzcH2Xo=tP2Two+f=zk8sW-o_AJ8qw@mail.gmail.com>



On 17/04/2025 01:15, Suren Baghdasaryan wrote:
> On Wed, Apr 16, 2025 at 2:52 PM Usama Arif <usamaarif642@gmail.com> wrote:
>>
>>
>>
>> On 16/04/2025 22:08, Suren Baghdasaryan wrote:
>>> On Wed, Apr 16, 2025 at 11:06 AM Usama Arif <usamaarif642@gmail.com> wrote:
>>>>
>>>> With this Kconfig option enabled, the kernel stores allocation tag references
>>>> in the page flags by default.
>>>>
>>>> There are 2 reasons to introduce this:
>>>> - As mentioned in [1], compressed tags dont have system memory overhead
>>>> and much lower performance overhead. It would be preferrable to have this as
>>>> the default option, and to be able to switch it at compile time. Another
>>>> option is to just declare the static key as true by default?
>>>> - As compressed option is the best one, it doesn't make sense to have to
>>>> change both defconfig and command line options to enable memory
>>>> allocation profiling. Changing commandline across a large number of services
>>>> can result in signifcant work, which shouldn't be needed if the kernel
>>>> defconfig needs to be changed anyways.
>>>
>>> The reason tag compression is not the default option is because it
>>> works only if there are enough free bits in the page flags to store a
>>> tag index. If you configure it to use page flags and your build does
>>> not have enough free bits, the profiling will be disabled (see
>>> alloc_tag_sec_init()). IOW there is no graceful fallback to use page
>>> extensions. Therefore, the current default option is not the most
>>> performant but the one which works on all builds. Instead of this just
>>> set sysctl.vm.mem_profiling boot parameter in your config file.
>>
>> Hi Suren,
> 
> Hi Usama,
> 
>>
>> Thanks for the review! The main reason is to not have to make a change in
>> both defconfig and kernel command line while deploying it. We can ofcourse
>> set the commandline as well, but just makes deployment more tedious, and
>> adds an extra commandline parameter. In our case, we only want to deploy
>> compressed tags, and if there aren't enough free bits, we would prefer to
>> disable memory allocation profiling than to take the memory and performance
>> hit.
>>
>> Would keeping the default value of this config disabled be an acceptable option?
>> i.e. the below diff on top of this patch?
> 
> Well, in that case I fail to see why
> CONFIG_MEM_ALLOC_PROFILING_COMPRESSED_ENABLED_BY_DEFAULT=y is better
> than CONFIG_CMDLINE="sysctl.vm.mem_profiling=1,compressed" ? Either
> way you need to change the config file, no?
> 

Ah ok, I always thought CONFIG_CMDLINE overrides what the kernel gets from the bootloader,
but I just tried it and it appends, as long as CONFIG_CMDLINE_OVERRIDE is not set.
Your above suggestion works as well. Thanks!


      reply	other threads:[~2025-04-17 14:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16 18:06 [PATCH] alloc_tag: introduce Kconfig option for default compressed profiling Usama Arif
2025-04-16 21:08 ` Suren Baghdasaryan
2025-04-16 21:41   ` Shakeel Butt
2025-04-17  0:11     ` Suren Baghdasaryan
2025-04-17 15:47       ` Shakeel Butt
2025-04-17 16:00         ` Suren Baghdasaryan
2025-04-17 17:50           ` Usama Arif
2025-04-17 18:35             ` Usama Arif
2025-04-17 18:38               ` Suren Baghdasaryan
2025-04-16 21:52   ` Usama Arif
2025-04-17  0:15     ` Suren Baghdasaryan
2025-04-17 14:33       ` Usama Arif [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=6305a60d-8bb1-4479-9111-86442c278e21@gmail.com \
    --to=usamaarif642@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shakeel.butt@linux.dev \
    --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