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 F4237CFC505 for ; Tue, 15 Oct 2024 02:03:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8731E6B0088; Mon, 14 Oct 2024 22:03:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 823E76B00AD; Mon, 14 Oct 2024 22:03:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C42D6B00AE; Mon, 14 Oct 2024 22:03:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4DA866B0088 for ; Mon, 14 Oct 2024 22:03:25 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 85183AC2E5 for ; Tue, 15 Oct 2024 02:03:08 +0000 (UTC) X-FDA: 82674189444.18.130AFC0 Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) by imf02.hostedemail.com (Postfix) with ESMTP id 417258000D for ; Tue, 15 Oct 2024 02:03:10 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Uo1TZpaE; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.166.174 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728957698; a=rsa-sha256; cv=none; b=2Cb0KksYVndYhGEodyw/ttl/i8QQJEHlm01pEHNJZFoUkPf/75rBOuB7lIPy0GKSeOTehM jCGbcRqIPD+0o0MClYgQKD6SZ5dMm0b6RcPStr3c8pSkCyHjbfG/SF1zEEKqoz3dnWqwEa +4fQvsHIMIBXX6SkyN0gRWdhXQw9xlU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Uo1TZpaE; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.166.174 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=1728957698; 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=2rzz1jGRp9QodkmkWLX5NeHSpM63VF3iwIHkCWIBMD0=; b=ykfW+IWVwwOMAmqQQuvCBEaGoSMtREZALYUIUC1RPqleEgZe4gE0xLRt9oKQwmvV7zegBV rWUqAUtEOIhnj2brookLuW0s7ujZy+OcgWg7M68jQ7sq6Wezcj70eyiGkgDi2LO3UCwOmm 3ufbXoGS2N1ImkZwTAW+GZ2Ra4cMClg= Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3a3b3f4b599so1085595ab.0 for ; Mon, 14 Oct 2024 19:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728957802; x=1729562602; 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=2rzz1jGRp9QodkmkWLX5NeHSpM63VF3iwIHkCWIBMD0=; b=Uo1TZpaEvdyX20nisDKwmEmBBhh46XnYz1F8ua+0/38hmY9/yyPv9HDCYlrlTMEgUe 3neUOaqRYJ3P30JKxDfy16V/dE4NDbPvuDqLo8eMsz/S1jhSH8MoU1TGhP06wlbmWtwA 0HYjPKJSBo50Mnne5zACT3T5qhIZW7npRkEg/3of5Wp7o0gjAXst1GrU8UAkzV/k5ejB 5DurUnXfpxOf+MrLQK4jto9LKqfY2Bp+vf9jw8sbAYSDzxhIga3go7t2K8yqf9LYKTpL UZdguX1aI6tBlFTc3RZX+nxvPzknwYMFT4CnOutYL7CfNysqoRE5xDY/QF8n8frxmnsA ukQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728957802; x=1729562602; 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=2rzz1jGRp9QodkmkWLX5NeHSpM63VF3iwIHkCWIBMD0=; b=ay86emNIgTDU/juzuV/CloLJbWq6tq06x0up9VvHfzIMJkBG/qglFnv2oqvQDsKsgA RghLE5WNHbqzUn275LC5IM8jF4eeJAE5f9bGMy/ItsN5iHfaJTUxJnbTl/B2AohCRL1w LesR/s6YF1PflKDZ5hFJzDpbASWOjL2ws1F4DAWAMfKaxHfvGvANxlBIa4mXGs/8kAnq RLw6dJqwctOHrtjJr7Zk5G9Bc8x0Mt/aVYUkWmPbPPn2CiJTmH79vQdyS130qKJcytgI enAEdUKaQ9nrkYs2N2R2/K/gX9U9rl+n30DnMKKMjDSJSK8lXNfEK7TkXcGbTYoF092B 4d3A== X-Forwarded-Encrypted: i=1; AJvYcCWua7/l6xcMgGXf6QcaapUWO/agDQ5n1Nsr2kR5O6eN18Zt5t+oJxtwRwlz7jDShlpn+pFDeI1WVQ==@kvack.org X-Gm-Message-State: AOJu0YyeVKIiHn7QnrWjdXoHT+3KCy+pBdakruDuXoMovn+e8FNJp2UW lp8/vLxr7irl6Ck4MvbrjBGAoDozB9rinnWIunrp3w5/RmiP5cPFfO3MPI8abnGfHxypSuxN5Z2 MkBJj8+fuqrv+6Ew7QEzE28GMQ1r/oM799TVr X-Google-Smtp-Source: AGHT+IFHRKUmX7WPQa7TLc3Eciew7PeeIWsTXjQyYb43yIoNadPTvoEyJAZLfxlGaMHaRWROX46C4pFUHE3PQcVkQ5U= X-Received: by 2002:a05:6e02:1445:b0:3a0:44d1:dca4 with SMTP id e9e14a558f8ab-3a3bd2b62c4mr13456695ab.6.1728957802071; Mon, 14 Oct 2024 19:03:22 -0700 (PDT) MIME-Version: 1.0 References: <20241014203646.1952505-1-surenb@google.com> <20241014203646.1952505-6-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 14 Oct 2024 19:03:10 -0700 Message-ID: Subject: Re: [PATCH v3 5/5] alloc_tag: config to store page allocation tag refs in page flags To: Matthew Wilcox Cc: John Hubbard , Yosry Ahmed , 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, 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-Queue-Id: 417258000D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: btiwox9qoe8h8mcn4eg5o4k9s7hz5wg5 X-HE-Tag: 1728957790-994856 X-HE-Meta: U2FsdGVkX18Q4OLKgPThaiEVf5FJITCnM4PIqjzlbZkwmnYJLPgI0m1xvHIjLPQbBjTqp/+oN2yc3qYr2BNMRydvRDBg95k1hNAQQ+N0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ZxmZ2EhT5q/Dw1noBmj3qQ1Ac6km8XUEwn96gM/Fux39kFicAIZkCDctWUkmZZ5dMSIm+cno4D10k+neVrsg5+p7nD8VoHPaLSutKGmdRNrJ650pEBy05EhAzj0rHY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.002016, 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 6:40=E2=80=AFPM Matthew Wilcox wrote: > > On Mon, Oct 14, 2024 at 05:03:32PM -0700, John Hubbard wrote: > > > > 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 tha= t > > > 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. > > > > I agree that if you're going to implement this feature at all, then > > keying off of CONFIG_MEM_ALLOC_PROFILING seems sufficient, and no > > need to add CONFIG_PGALLOC_TAG_USE_PAGEFLAGS on top of that. > > Maybe the right idea is to use all the bits which are unused in this > configuration for the first N callsites, then use page_ext for all the > ones larger than N. It doesn't save any memory, but it does have the > performance improvement. Thanks for the idea! This would be more complicated and likely would require additional branching instructions in the allocation path. I'll think more about details but would prefer to get the simple solution first before adding more complexity.