From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE6DCC369B2 for ; Thu, 17 Apr 2025 16:01:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D4906B010B; Thu, 17 Apr 2025 12:01:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 282D36B010C; Thu, 17 Apr 2025 12:01:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14ADE6B010D; Thu, 17 Apr 2025 12:01:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EA7786B010B for ; Thu, 17 Apr 2025 12:01:13 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 47A251208B8 for ; Thu, 17 Apr 2025 16:01:14 +0000 (UTC) X-FDA: 83344000068.14.883FBFC Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf26.hostedemail.com (Postfix) with ESMTP id CC5BF140008 for ; Thu, 17 Apr 2025 16:01:11 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=cnuaV899; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of surenb@google.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744905671; a=rsa-sha256; cv=none; b=TYrTSgF7quyiH0bHwyc296HLkx63iDZXk2RHvJGIzsoMwwbp/wHBpHuXRl2jBBvywuVarX th2lWBstmOErHnbk8UNNw9rjxIHxNPKO9ZVZ0ahS8RHrjmunu1ucswBxBOhS50ssfxcu+r sIlcdcjQES1MYwyF4Ya2N9i5sOFsdSY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=cnuaV899; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of surenb@google.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744905671; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RXvqmdkxDwobcsY3vlLExzQPXBm/4w62Fdyp5UZdEWg=; b=asZYkn4mCR2ohtSb/zLMGbvcBIriDTKE0+zrufRVwYzN+tVN9oorrbkq5+CoKavQdfOnyH JgB6JJ6c8r66TQXut2zLZwFURHU+kmlyC7uasb6q94TWxyeANaqRnfM8VzGD/7OJbKL6Aa blqbwjfvRkGqXg1i+Y6Ljnq5mcdzU6Q= Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4769e30af66so391771cf.1 for ; Thu, 17 Apr 2025 09:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1744905671; x=1745510471; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RXvqmdkxDwobcsY3vlLExzQPXBm/4w62Fdyp5UZdEWg=; b=cnuaV899QfBq3hlRjNrPAeJe8x0zmXljvOREOIRrhN9H7KDU+iCr7jbl2tvm2gT12e lnYLAltlz6oPfgtzteGmbIPG6lL2GdI34rJ4ATTk8nKvYP6DOSLv528HsK+d7K7fhEoZ Lpwibq55KKDb/y0G/kSOIRuiYYcwlNwVpgGTFbdPsVMHVROpGuoC+2+QtZP1brEs3D/g qdXEjevEXo7kisOz1sliVgS2GgAhJuVygfumunXpLXdzJd4SbT9SgqaDeS9d0dMqLxFx Xp7xWOkFZIAdJWZkEcd5Ig+Ho4XZ2bN05suq3EB7Mfl8vSYIqwMp7pNFIyPKi8A86Tkf iOOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744905671; x=1745510471; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RXvqmdkxDwobcsY3vlLExzQPXBm/4w62Fdyp5UZdEWg=; b=FIeTvh0uHq47PXfeIVEBBdhr5xVIZ4CTLCaPNUxqTAIuSjsV77DGXdljHk1KGsP/RO cysKcXFFBY9XoRGEE2ima4KfDNbVHA8jcrmtdmqz0IG25sGZk91p7r0H54VqkADfuUGv mSigB1J1eqfj4vTZtxQyt8Vc8HRZ9EnF3bsjJd14OD+VWKhzg9BZjuem80AAPcchKOfq sWPcyuc1TVldNb7hZLRYfMtDyMZS0QbmAd7/UAOAlDYxGznigQfPN5n2+qVskELybc34 Fbde+n0AIOG49+jecvJ4k5HCJq5FX3Oha35S4hx1SbMCnIpAMG8r+tBQ/Ph0dfsqz3UK mbrQ== X-Forwarded-Encrypted: i=1; AJvYcCV9JsvGBTb383jl4e7nkEfKLcYY+cB7MdXrIFNtfHcZ+hbcwG8cO+t1cvqGUREv2ZCYq29H1iiQiw==@kvack.org X-Gm-Message-State: AOJu0YzZa5VFVpLVc+Q3lPFA/0dOYMAozHi+Jhu3cAdFwdXFazhIcfQ8 P9ShEfbARpMDGSsS/2OKsdJOLvI20P+g/+IZ958/FNASWmejjK3SRTeGQTPPtj0s4rfEVnugPZC Rry8ALvVACEABvHsDbYNBudGgb+nCvcxbfSgM X-Gm-Gg: ASbGnct47U/zltfJHYXC8ByUIeb4VXcqGNiUFI+nQNVE2sbuicGRVeAQUEamfsB1Q54 HfYxvzDeUSecTWNp/v4JSm5sN5USx0PvUvQ7/H/fXQ6n4L9/mP7dKM5Cnq0/WhkD6LyONZ9rWv1 0APbWT/mlP68M3LzGCxYWxgx9NGU1HhJ9EsJ/lXA4pSqapY5cB59x6 X-Google-Smtp-Source: AGHT+IElVrWiz+z6aR7JhOdXzIoqqu2MsQ71ji5T7pH6bgq7qi5lY94wzW3l+XdMMuRQ1ZiujS3QZITYZkuudyFzqyk= X-Received: by 2002:a05:622a:1449:b0:477:7644:b738 with SMTP id d75a77b69052e-47adfca3569mr3481591cf.17.1744905670196; Thu, 17 Apr 2025 09:01:10 -0700 (PDT) MIME-Version: 1.0 References: <20250416180653.3438158-1-usamaarif642@gmail.com> <72pac6pkjebt6xo7engiuuu7r3zr7fu6fh6bj77f22m7gslxgr@3gjawofplas2> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 17 Apr 2025 09:00:59 -0700 X-Gm-Features: ATxdqUGoXYeBBRka0OEQp7wUI-t8t96QTHYYbOOhQhBMvYDpg8pP_c2LgExMKM8 Message-ID: Subject: Re: [PATCH] alloc_tag: introduce Kconfig option for default compressed profiling To: Shakeel Butt Cc: Usama Arif , Andrew Morton , linux-mm@kvack.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: CC5BF140008 X-Rspamd-Server: rspam04 X-Stat-Signature: ohy96cia9mpb36px6xr74u6i31ozhs35 X-HE-Tag: 1744905671-939033 X-HE-Meta: U2FsdGVkX18YPhwDE2u8QN3Dgpi7VQ8+rP6wbfWZ4pM/4A5tlMDm50tbPnxrr2eT5zpQv9qW+u8Gsdeb0apBSDHBLBjOTDdGgdtsoXi6KnhBRd5p9sU64S0S7TANDorLb6P8ka73pw6PngZGnXKNS0204p70pfmhhdomVW3vh6gRDmQ0MX6CY1oJMxzBZMM7RauMBgAjm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ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Apr 17, 2025 at 8:47=E2=80=AFAM Shakeel Butt wrote: > > On Wed, Apr 16, 2025 at 05:11:11PM -0700, Suren Baghdasaryan wrote: > > On Wed, Apr 16, 2025 at 2:41=E2=80=AFPM Shakeel Butt wrote: > > > > > > On Wed, Apr 16, 2025 at 02:08:31PM -0700, Suren Baghdasaryan wrote: > > > > On Wed, Apr 16, 2025 at 11:06=E2=80=AFAM Usama Arif wrote: > > > > > > > > > > With this Kconfig option enabled, the kernel stores allocation ta= g references > > > > > in the page flags by default. > > > > > > > > > > There are 2 reasons to introduce this: > > > > > - As mentioned in [1], compressed tags dont have system memory ov= erhead > > > > > and much lower performance overhead. It would be preferrable to h= ave 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 k= ernel > > > > > 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 doe= s > > > > not have enough free bits, the profiling will be disabled (see > > > > alloc_tag_sec_init()). > > > > > > Is it possible to fail the build in that case i.e. check the page fla= gs > > > availability at build time? > > > > The difficulty is finding out the number of allocation tags in the > > kernel before it gets built. Maybe there is a way to add an additional > > post-build stage to run that check. > > Yeah that would be good to have. > > > But even then making this option > > default and causing build failures does not seem like a good idea to > > me but maybe I'm being too cautious? > > Oh my question was orthogonal to the patch. Basically some users may > want build time guarantee for this and they can enable such > build-failing opt-in config/check. Yes, that would require the post-build step to check the number of tags vs the number of available page flag bits. I'll add it to my TODO list but it won't be at the top, sorry :) Volunteers to help with that would be highly appreciated.