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 A4F1CC369B2 for ; Thu, 17 Apr 2025 14:33:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C10E28008F; Thu, 17 Apr 2025 10:33:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56FD2280088; Thu, 17 Apr 2025 10:33:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45CE028008F; Thu, 17 Apr 2025 10:33:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 276AB280088 for ; Thu, 17 Apr 2025 10:33:22 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9AFECC193C for ; Thu, 17 Apr 2025 14:33:22 +0000 (UTC) X-FDA: 83343778644.18.5D41BAA Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by imf23.hostedemail.com (Postfix) with ESMTP id BAC3E140014 for ; Thu, 17 Apr 2025 14:33:20 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HTRG1eQb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744900400; a=rsa-sha256; cv=none; b=3KF0Xt8Qwb0IhHYvZBZpiGQjVlpYVm/LZoy3aZ9D+YaQvXcWia16234FFOVs8NdNawMENY zquE4GIOmgsLu3WEc45MNkQ7zLZwKLdst0nfQdcji87as4f6/CsWVuIgRvsH2Tab3wpc1r +ndIu0qlYV9LONjABMULxSu/W/ojU2M= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HTRG1eQb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744900400; 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=52Wv4BPTjON7msPoYeHU8mR+/WHRDqEO03Lynu+d994=; b=CPRpEgJN5aoux12+J8tiIIOAoZPVVAHl+XgZSaKQgu3BExRqkU5gn0Zl0BCVkzy3cVqcZb O3l4tGoTiKvJV3I3vYrhWZ13XIlPjKtl2tfWKWjjPTI5UzHphlGJIrp+yDRK2YCjAzvISW fWy57TMxV+qvgR05ld5rAEVpaGKWsQM= Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-38f2f391864so507844f8f.3 for ; Thu, 17 Apr 2025 07:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744900399; x=1745505199; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=52Wv4BPTjON7msPoYeHU8mR+/WHRDqEO03Lynu+d994=; b=HTRG1eQbRAeV/6dXO+t0lMzqL4DAKrKnr054bMYpmjjB7iZT3Uv/Q3QYJ+lWO0SZrp s1jMkAFXX06bYkyxqwzXuNckw52nNO3RRt0LZL+6Qlj+g2GofxaGjckt60XPV8jMnlhU T0YMuLDUso8+k8+hPl0TtBk2n4RzX7Ggkfue/A7jbPAoihW26Cr+Pu86tfKcZ7VueL75 sw5GARpDoZyMnZPLkEsPXeMXXW3lO9StYf7KH75tu06AxcM3SpX2dYW/NR2gj1LHLKqx owC/tX7d1l5h4uQghjpKiFfKHnuX98DyvJFrG0tLdkVdnEkKWTpe34NcAn/8+D8SyIRn psFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744900399; x=1745505199; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=52Wv4BPTjON7msPoYeHU8mR+/WHRDqEO03Lynu+d994=; b=mBCYHrjw6a37dMB079hFhlo3i0xQC4dOkHscpzria77XWxdAUckqEQuKxtYkwTj7BN 5UIKY83vjEyzkkzvHJRGO+rhN93KCTDnjRsXtjMYN16+RpgGhi8gZ8uRsbXyINh27xch OJdaWnCAcl7hlXCWQ4ENGk8EzoaZAjw69/0nsQcyYq0D0a1Yu1l+2HhzC6JnVyc+wAKi hhrBOUEsbjdLKNWdNPamaa9X8QRtvp73vllL6W8lf2QgIpj4a2PtzXieHxxfy61dD9pg QJLXDqWQHyFlsbsvbJYg8XWadCPxHOF8FDkxwoD/JxGvTV3afv7Ryy/pVRLl28coxDny WMxA== X-Forwarded-Encrypted: i=1; AJvYcCW9r6VrKcSwM5wdjVHe+uTbW8UJcjnZcDBCFEKUeFSaVprt4t0DGv2pFGQc01xIz9miaHkj4uU27g==@kvack.org X-Gm-Message-State: AOJu0YxnvuJ/tL1OOsAN0p8riUB6e7MwFLXiwAznMLRDTj1kMhSsqDbQ vhpJ7BCc+jpeqKRzu8HjgLXbYpbbaLzrHazV/iDWwNbWKeRaDoti X-Gm-Gg: ASbGncungot0fvJTAjdlPmbj/EmQs6v5JbYqgcJgb4xrTF35DRkSBLdkT3LhbE6F1Fj 9dtkormKuLknxB6dKaoB/PWO3me08CuW/RaL07KqHxXd09Q/VwxaE2norX9g/cZSM3kAD59wvJS TPQiHUX98H+qQbKtO+kMtuVwM/FpgNCcpcj1/g26r8oywmdyoX6s/nWdNQmLhd95Oj1MvbdgqK5 I2AdEBi7CtzaQN9SIjelW0EIE0unDyI39nJayTtdGZ3YbjaloUHsBNfnaldQ+eGzhrU9xx9hn4L 9rNtA69k1XH6XZLpedaIQBx4CTtUqznWwnK1U5m4naNVlIOOm6Z8EZXutd/ahuQ3x2P9pPnWgrv 7g2S15TzUdyIQkicgj/dLyJn8LaEFXE3f3g== X-Google-Smtp-Source: AGHT+IHcOhlIlImAKAHfR/VqeZ3R8aNsdQlf/5oy9TNhQ/sv1LtjfP3zfaqs87wh+3aL9FErd5ELaw== X-Received: by 2002:a05:6000:420f:b0:39e:e588:672a with SMTP id ffacd0b85a97d-39ee5b13bc7mr4755360f8f.7.1744900398883; Thu, 17 Apr 2025 07:33:18 -0700 (PDT) Received: from ?IPV6:2a02:6b67:d752:5f00:c46:86ac:45ea:7590? ([2a02:6b67:d752:5f00:c46:86ac:45ea:7590]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39eae977513sm20160966f8f.42.2025.04.17.07.33.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Apr 2025 07:33:18 -0700 (PDT) Message-ID: <6305a60d-8bb1-4479-9111-86442c278e21@gmail.com> Date: Thu, 17 Apr 2025 15:33:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] alloc_tag: introduce Kconfig option for default compressed profiling To: Suren Baghdasaryan Cc: Andrew Morton , linux-mm@kvack.org, hannes@cmpxchg.org, shakeel.butt@linux.dev, linux-kernel@vger.kernel.org, kernel-team@meta.com References: <20250416180653.3438158-1-usamaarif642@gmail.com> Content-Language: en-US From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-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XV0vx4+kxOWs13C6/hNKRn SuL3rSCR sFkAePOjK0D2J1NAeM/ONZA3yK5b9/L9FQbPIsyvJLa63DKMo7+3f2O64/C9WHT28zqAv X-Bogosity: Ham, tests=bogofilter, spamicity=0.001498, 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 17/04/2025 01:15, Suren Baghdasaryan wrote: > On Wed, Apr 16, 2025 at 2:52 PM Usama Arif wrote: >> >> >> >> On 16/04/2025 22:08, Suren Baghdasaryan wrote: >>> On Wed, Apr 16, 2025 at 11:06 AM Usama Arif 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!