Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1812916rbb; Tue, 27 Feb 2024 01:47:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVl9eFeSqZdw9dPRZNmsgTQlLDgjt/u+QBNei7X8norz+8w0iCDzMqREmB/OeNtM1aYjaIhMo5CePSUx2FnGo3FPY0Jqe+HxQfzjyN9vQ== X-Google-Smtp-Source: AGHT+IH5JrsnIvOVvvsE2sXEM7sb8nUtvXUGUNePNeEk6XWxpelu5PXYSnhZ4ESLTH7yB4nwNJuj X-Received: by 2002:a05:6a20:958b:b0:1a0:e6c6:fa with SMTP id iu11-20020a056a20958b00b001a0e6c600famr2656508pzb.7.1709027270266; Tue, 27 Feb 2024 01:47:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709027270; cv=pass; d=google.com; s=arc-20160816; b=fynM+ZuOoszElzEfgVRXKzGOgOmeaEwifCEhvXTa6+nngpETk6IaWmBYhkBrDLSpo+ xYWGQoJPx5kDdm7CMaOaRiqvg9C7xPizLUJ9P5VD+G/21rYzuMmRg7ZlDBCfTgQRjQS4 nUEsKEwvA1uixsnRAfpqPXBVzXFsA6i4oB3iMVK6XCZmZ5+d0VsAs4m3ifur4Ppd/vmP Mt7anHAaya8SezrlGOgEQsVpztjSrh+ITzq0Qeu8qynrbANrd83CH+COST8Uwj8GI43e BxGJa4voa5upGQ49oGe9ryjA3c7vXi+DavRVFKq1UHN9M/xorMsl0AOWt32VdQt/ANB3 XzfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=9nlWS0taAPbDFSntCaJ2TVsOBW7I3UD2z/xphXUPlTY=; fh=UwD/H3ywsdD8tnw4ySuZhMQUkhKuIDpEkmEQBTTD7Ro=; b=EWqMcZa1RU0697zSRqUV+crnVzgyQ1jQ49a7XeGYGFZuoATEobcIe0K571cfKnz+6Z mWalXi+vChmO9k0Eu7kDr92cokj7AGEaBkW8myIAf7x4oZVnJ/583K4Ie99wMJ1A11iu cJToCg7y3I5jpH/tF5rksOD0uYvwXFD62qPAo/LYja5sDoipeqlHQ203EedNBpVC8Prl cdCJOas7vTuGX8dA6xUAN9nQZIqYnXBFjmK+psMs6KCoa59tYEMVzr32jnhqRCzXakQl qzZO9jstY5Q2J2XSfsuVO8jI4cM+gACKJSo0aMZA02Za65BJNGqA1eNeBUbvq0PY57Yz PY/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bnFZzcs8; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-82988-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h17-20020a635311000000b005dc4240cc6asi5217067pgb.256.2024.02.27.01.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 01:47:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82988-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bnFZzcs8; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-82988-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A94C52845A8 for ; Tue, 27 Feb 2024 09:46:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CA70137C25; Tue, 27 Feb 2024 09:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bnFZzcs8" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C7C856466 for ; Tue, 27 Feb 2024 09:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709027169; cv=none; b=dCxFe5IF3TFDGzcy9BwJaYacsvrYVG3YdeUVM5+uzx07dj+t5KqLKUURGpWbcK011dvcJgpQ1SamZGFcioPgMIclEteRZJBc9IAYRZAUHkImV50hLgdErq7t5zfjoqLLObQqH6FdX0uSCkGEPWU/G1RQpylfsa8m6vxCzKw3d2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709027169; c=relaxed/simple; bh=+ytKwk3NacclcWujYuHxkN3+LNPa8DzWTEDtglex9XI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XXDahg1UE7Htf5my5loF44mSalrZL6jQ/pNYZHNygg+V8H1poqF+7H/XphTJwwMlXJ2fHoLp3NDRxBf2xc6ekZGQV4tJia3xWI30qs5cREQfaUk3yO+TEIBPJjfx8+Zrcc/bNv+FMtYf6c/cLJt5CfoAJE4my2S2XK2VUVACTCE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=bnFZzcs8; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Tue, 27 Feb 2024 04:45:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709027164; h=from:from: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; bh=9nlWS0taAPbDFSntCaJ2TVsOBW7I3UD2z/xphXUPlTY=; b=bnFZzcs8sYgZ/WAdp0TCl6iE8mORl4n3jkZU5UpN+8Yhyt3ppzRDI0kT83L14Ajo+/3/GK cZPS6F/lDYPzAIXE3bk0+iyBp+ia2OM22CiV0C1VfGZKHiyciWdHzAc5YyzQQOOBpcszQR zOdtNjr321Tq148zhVLstoxTE62xRfM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Vlastimil Babka Cc: Suren Baghdasaryan , akpm@linux-foundation.org, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH v4 15/36] lib: introduce support for page allocation tagging Message-ID: References: <20240221194052.927623-1-surenb@google.com> <20240221194052.927623-16-surenb@google.com> <72cc5f0b-90cc-48a8-a026-412fa1186acd@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <72cc5f0b-90cc-48a8-a026-412fa1186acd@suse.cz> X-Migadu-Flow: FLOW_OUT On Tue, Feb 27, 2024 at 10:30:53AM +0100, Vlastimil Babka wrote: > > > On 2/26/24 18:11, Suren Baghdasaryan wrote: > > On Mon, Feb 26, 2024 at 9:07 AM Vlastimil Babka wrote: > >> > >> On 2/21/24 20:40, Suren Baghdasaryan wrote: > >>> Introduce helper functions to easily instrument page allocators by > >>> storing a pointer to the allocation tag associated with the code that > >>> allocated the page in a page_ext field. > >>> > >>> Signed-off-by: Suren Baghdasaryan > >>> Co-developed-by: Kent Overstreet > >>> Signed-off-by: Kent Overstreet > >> > >> The static key usage seems fine now. Even if the page_ext overhead is still > >> always paid when compiled in, you mention in the cover letter there's a plan > >> for boot-time toggle later, so > > > > Yes, I already have a simple patch for that to be included in the next > > revision: https://github.com/torvalds/linux/commit/7ca367e80232345f471b77b3ea71cf82faf50954 > > This opt-out logic would require a distro kernel with allocation > profiling compiled-in to ship together with something that modifies > kernel command line to disable it by default, so it's not very > practical. Could the CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT be > turned into having 3 possible choices, where one of them would > initialize mem_profiling_enabled to false? > > Or, taking a step back, is it going to be a common usecase to pay the > memory overhead unconditionally, but only enable the profiling later > during runtime? Also what happens if someone would enable and disable it > multiple times during one boot? Would the statistics get all skewed > because some frees would be not accounted while it's disabled? I already wrote the code for fast lookup from codetag index -> codetag - i.e. pointer compression - so this is all going away shortly. It just won't be in the initial pull request because of other dependencies (it requires my eytzinger code, which I was already lifting from fs/bcachefs/ for 6.9), but it can still probably make 6.9 in a second smaller pull.