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 82F52D18159 for ; Mon, 14 Oct 2024 23:57:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 201F76B0089; Mon, 14 Oct 2024 19:57:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B2226B008A; Mon, 14 Oct 2024 19:57:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C7E16B008C; Mon, 14 Oct 2024 19:57:13 -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 DFAF26B0089 for ; Mon, 14 Oct 2024 19:57:12 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 81B9E81318 for ; Mon, 14 Oct 2024 23:57:05 +0000 (UTC) X-FDA: 82673871294.25.A86A100 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf18.hostedemail.com (Postfix) with ESMTP id EA9811C0004 for ; Mon, 14 Oct 2024 23:57:07 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Aj5iwvnL; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728950114; a=rsa-sha256; cv=none; b=Xqr657N75ZqocpQcM0j5zivhuXsVYK18HIJGDcJKliaYQf6oGOZxbZv2k0j7SAUT0NfFu/ rnKKpl/zDRXGhe7YdGfYeP1DeQRQaBDP4oikPS6G6BbKcTVOpg6IRAAQZWr1TRpxzXUHEK abhHWBmia7QHG9euNeAMUE4nISOWTy4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Aj5iwvnL; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf18.hostedemail.com: domain of yosryahmed@google.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728950114; 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=8mMv1+/qYexUlPZZXjGJlHSVSZyeZZNxj0qHf5BogRM=; b=0MAye5TPnwwxMcRKLtLPHtr2chqzvfSB9CrtQ0ieghv7K06Uo77NUJs0pXagV5n89je7nM aa0wO07yD/Rnxl62fjj8y7R8KVLPOsnP2sk1pI9LtNaoSo0lHOoVUJmsqvadwe08+9f/qR yPu+m1b0WdeDzaJ4hFrhHpAWG2TJi6w= Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a99ffeea60bso293168566b.3 for ; Mon, 14 Oct 2024 16:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728950229; x=1729555029; 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=8mMv1+/qYexUlPZZXjGJlHSVSZyeZZNxj0qHf5BogRM=; b=Aj5iwvnL90ax15K0DHpL7Wq0KB4pjhVP91pUYFALxLCq+RY/9YV1zG/WKxue9FQbZU Hoiv1838/LCjNAj6aPDHq0elzH2IwntEf+o82fVZolpMBgdlXK/28cas9uAcxnHDsaOo kHxqcMWB0Y+BsS3ZsOOKTJX4/ViAPDPYoIOAjVBDzN0DSLHARhIp7ovRvDO+wKQF4SVO Mn3YfF0HAO8ub/iAN9KyiKweh3v1s1yww9b1b02JmaM4/tM4Cj6qCqHwPosmUDiVSX2z mswMp1Q59p0ghCRLMVFpkTL1mpCQtsD77J4H+IzotlUu6mT2nAZDldZuodUvqoTD3ID6 1jAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728950229; x=1729555029; 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=8mMv1+/qYexUlPZZXjGJlHSVSZyeZZNxj0qHf5BogRM=; b=oCJeCaHJZBIe2ul/D87nqigbFeLHs9GJvsgfjBE1xZPdgld9TqRQ8T9xY5u11rDE9d SGBDUuGFhYSbF/guNjXx/NyvpyZOglqM5pqqcQ4nrGszsjm0XiCEpWMxBjpbWDuJWX6S HgVnpL+yrRylQV1/XV4iOP+XJ23BrDa4/Kb6Gtzj4mnnLEtllNKYRU8tPM3OGhA0OPu1 7mf6UQ5+O/Rm0p/6LMD7QC20xWMZY0K4aB60jqVqq9dM2MhJPpOAMVnBeC+LYwEhZFB+ PlNZytqKRxQjaMLISjQxsq33m+SgbLZ6bv2MF5YPpcJcNWJQpSZEFBTvCZ3Ms38ujxZT iUDQ== X-Forwarded-Encrypted: i=1; AJvYcCXdkoKgWhele7KoygSEjZwZa9zNkc1vpOI/GfliRTpDIQDVwiyxo7e/nNaP1G2K8VCjMCJumXyGSg==@kvack.org X-Gm-Message-State: AOJu0Yw61e66d9EtSPZGLYqoFSqgD7ILhKxcWzk3r4t0/iVR3iWeD3Fx GEi8uPwkynAufYfer8wGckdidezDyZPfL/+Rf4//VVyVkOMTmaRWh6plDOkHkyUDzuQRJYnmJBo GUpU5Jpvdhm0RbfVHnv2EpNiRObDoTqFTLMFk X-Google-Smtp-Source: AGHT+IHCRbSEFH8dvrQfl8w/MPZdNADUHU+gGQqJoXe1fpzCrFvaqa6J94TlpNAt8drNzGuJlS0SjcmCg/I0CEvyR2M= X-Received: by 2002:a17:907:2ce6:b0:a99:fb56:39cc with SMTP id a640c23a62f3a-a99fb563b89mr582010566b.38.1728950228942; Mon, 14 Oct 2024 16:57:08 -0700 (PDT) MIME-Version: 1.0 References: <20241014203646.1952505-1-surenb@google.com> <20241014203646.1952505-6-surenb@google.com> In-Reply-To: From: Yosry Ahmed Date: Mon, 14 Oct 2024 16:56:32 -0700 Message-ID: Subject: Re: [PATCH v3 5/5] alloc_tag: config to store page allocation tag refs in page flags To: John Hubbard Cc: Suren Baghdasaryan , akpm@linux-foundation.org, kent.overstreet@linux.dev, corbet@lwn.net, arnd@arndb.de, mcgrof@kernel.org, rppt@kernel.org, paulmck@kernel.org, thuth@redhat.com, tglx@linutronix.de, bp@alien8.de, xiongwei.song@windriver.com, ardb@kernel.org, david@redhat.com, vbabka@suse.cz, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, pasha.tatashin@soleen.com, souravpanda@google.com, keescook@chromium.org, dennis@kernel.org, yuzhao@google.com, vvvvvv@google.com, rostedt@goodmis.org, iamjoonsoo.kim@lge.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: EA9811C0004 X-Stat-Signature: bp3cjistb99m9misfb7ni5choh9nkiet X-Rspam-User: X-HE-Tag: 1728950227-985917 X-HE-Meta: U2FsdGVkX1/2uHeVGPmbjebt7NVrMt5B3SxxJqor/lg1YIR6LJTN+3Aet0VJWlZjpMPcucR7aDcwEXUA4sWC2D511zWAhAqYLhBOk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CNHB8CTuvwr/AM+uxeW5FhSEg34w4UKMDRtrYmDhAbFP0IKJGXUNvq6PE+nMgCbn4pWHxCC96OMwMZ3brfTdLCMbxos2YNhBnJ+G1s4zTV X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 Mon, Oct 14, 2024 at 4:53=E2=80=AFPM John Hubbard = wrote: > > On 10/14/24 4:48 PM, Yosry Ahmed wrote: > > On Mon, Oct 14, 2024 at 1:37=E2=80=AFPM Suren Baghdasaryan wrote: > >> > >> Add CONFIG_PGALLOC_TAG_USE_PAGEFLAGS to store allocation tag > >> references directly in the page flags. This eliminates memory > >> overhead caused by page_ext and results in better performance > >> for page allocations. > >> If the number of available page flag bits is insufficient to > >> address all kernel allocations, profiling falls back to using > >> page extensions with an appropriate warning to disable this > >> config. > >> If dynamically loaded modules add enough tags that they can't > >> be addressed anymore with available page flag bits, memory > >> profiling gets disabled and a warning is issued. > > > > Just curious, why do we need a config option? If there are enough bits > > in page flags, why not use them automatically or fallback to page_ext > > otherwise? > > Or better yet, *always* fall back to page_ext, thus leaving the > scarce and valuable page flags available for other features? > > Sorry Suren, to keep coming back to this suggestion, I know > I'm driving you crazy here! But I just keep thinking it through > and failing to see why this feature deserves to consume so > many page flags. I think we already always use page_ext today. My understanding is that the purpose of this series is to give the option to avoid using page_ext if there are enough unused page flags anyway, which reduces memory waste and improves performance. My question is just why not have that be the default behavior with a config option, use page flags if there are enough unused bits, otherwise use page_ext.