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 14680CD4857 for ; Wed, 4 Sep 2024 16:35:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 927146B011F; Wed, 4 Sep 2024 12:35:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AFDC6B0126; Wed, 4 Sep 2024 12:35:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 702676B0125; Wed, 4 Sep 2024 12:35:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4ED1D6B011C for ; Wed, 4 Sep 2024 12:35:43 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 001791A16F7 for ; Wed, 4 Sep 2024 16:35:42 +0000 (UTC) X-FDA: 82527606924.10.D82E17E Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by imf07.hostedemail.com (Postfix) with ESMTP id 465C140016 for ; Wed, 4 Sep 2024 16:35:41 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Ziz77QtD; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.177 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725467646; 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=CVVWyulqkWcIIt3eaXgVpDF1IQ1j/qkoZQP/yErWHv4=; b=rlwO2b/JuYFGsmAJg5Ez9TO4dDQYbFeLsHvPy3Mk30cNEvUKzZQk83/hurZ4EYe3KMqvZU N6ChUefQPct/VQkIrWK2M+HHdQMIspCLYOADvDa16jcinqhJ4rPpZZ7JKqVptB2954tRon K2LasVoQes8ZT8o3i2x3AXzoHkQNLxY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725467646; a=rsa-sha256; cv=none; b=mNxpz5Y48xtxaPAddRTyGSc0rPaiCsR6GPMon62Xh+bj8zPUtmrXO4cqJ/hMS58PMxCE49 N9o348adN55zOhiNcfirtE9vYNQZpune7X17U9D1K9ceXkzEgWUOGZBZyGi+H+juBkDNtO ittuxeIkK83AuZhNEcm8D6AydKl27EQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Ziz77QtD; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.177 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-4567deb9f9dso292401cf.1 for ; Wed, 04 Sep 2024 09:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725467740; x=1726072540; 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=CVVWyulqkWcIIt3eaXgVpDF1IQ1j/qkoZQP/yErWHv4=; b=Ziz77QtDDWzk0viIsZaTMhvd3tO6MMzdD7VFNL0POcfv9d+5ffohAV+lmJOBMs/jMS HElXroEw1Zyv2OZRuKkhx5QJEy94eBl0R+op8Mz02KocW0JBn2FtrWHagP3xNDzODQO+ Stn9DrEnjdjxirEYB8aOVyA+jeqF9qXWLCpV7+0rF99oGejHoeMT2idMgnc2DMfROMDd eTrpTmW8aCFr3/xBSVrd7QAlSJ0jyab+78cwRTDGNwIxKvsDfyOqkDSymRFbJE/FwyuO CGtisUY7BE0P2HbQNVrKf27uSnukc6GRcl45L03IHzTN1XOl1ZbTyHN116SWZ2qqpWbs HTeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725467740; x=1726072540; 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=CVVWyulqkWcIIt3eaXgVpDF1IQ1j/qkoZQP/yErWHv4=; b=UYBN8/N0GYLpA4AEWZil5v7WVNGbfCAukjAG6z3xKP4iLaZ33InnDPlI+Z3jYtuoYi 4a9yOQvrLxk/HfR6Xa8obruVoREbBrqb8JcVU8hsvbAK9ia0vKeNd0PYYpJ8OkqCm02m NUjxH2TaHCAgLBY55OGMXI7L4uvzmohlm9wro+NV+4eu9/DDp1clivQQKcik3bQYToi+ Tbtg8Q3AWX+Y2s8Y/esDoGXfEts4cZ0khJ3iprN35XEYURV1r9u7KuHtc9Zt18wWuqfi 1BKkN18a3elb2Jyzn6O7tRZRucn4YkWbI7WnI541joTBr0v//xBl5eAr/nOn6rrHX9G+ f8qQ== X-Forwarded-Encrypted: i=1; AJvYcCXo3jFQpn5W8IC+qwG1dh1+WTO2Hir980WW2qihxiniq4tEvHckYqIoGc/GLZrV9CTWjc76AV2kOw==@kvack.org X-Gm-Message-State: AOJu0Yz2HuS5QwOt2kiCBiVGAZpIPDxUWFxQq/Rt/SPiQ1/Lo9nqrliB ELqrU3qRHO2GxHuD8Ldr8yGmNEyXA3x6J9/UFpdeke85pldUxvbGhym+OFLMo8TLuyXAXdtJrHy hVJAWfOH7Lpm6mPax1b3DfypFdHX2b2dkQglB X-Google-Smtp-Source: AGHT+IFRosENkf6QvFVAL8Dd3CPNJYACxr4z2huPX4vhkPrrEkzPkP3ySL6yLGZMIV2DOLm7ZQ5Q5fQT5hqm0DOdCB4= X-Received: by 2002:ac8:5993:0:b0:456:7501:7c4d with SMTP id d75a77b69052e-457f7afcf16mr3378481cf.9.1725467739803; Wed, 04 Sep 2024 09:35:39 -0700 (PDT) MIME-Version: 1.0 References: <20240902044128.664075-1-surenb@google.com> <20240902044128.664075-6-surenb@google.com> <20240901220931.53d3ad335ae9ac3fe7ef3928@linux-foundation.org> <3kfgku2oxdcnqgtsevsc6digb2zyapbvchbcarrjipyxgytv2n@7tolozzacukf> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 4 Sep 2024 09:35:28 -0700 Message-ID: Subject: Re: [PATCH v2 5/6] alloc_tag: make page allocation tag reference size configurable To: Kent Overstreet Cc: Andrew Morton , 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, jhubbard@nvidia.com, 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: 465C140016 X-Stat-Signature: bp45sgzz59nuqrx81fpcpc83xq9fdsa7 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725467741-395356 X-HE-Meta: U2FsdGVkX1/ffztG4x1qPP77kV1E+92shdNUudDbh2J4ZyCuxWmySel7512xK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ZsxUnSOqO02ivDAFiaTRnCTXv1k5/+DXDXAmV+VLIn+CE4jKaTp/+MRMaxBjWulraFudrGMD9HiaE5zrCseb1ztLNxAfoM9PRCfnRYf0VlflPeADCJht7ovDWwyWNPn6c52ijB2SWbgL165fOqd/1CdPyclSgpyMSUwCMhDz5j6Nj11Ypu56c0+en/8bMzZNBZaQUnWPccE/pnf+CsJoq1FMHN+o/31kVVmQ== X-Bogosity: 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 Wed, Sep 4, 2024 at 9:25=E2=80=AFAM Kent Overstreet wrote: > > On Tue, Sep 03, 2024 at 07:04:51PM GMT, Suren Baghdasaryan wrote: > > On Tue, Sep 3, 2024 at 6:17=E2=80=AFPM Kent Overstreet > > wrote: > > > > > > On Tue, Sep 03, 2024 at 06:07:28PM GMT, Suren Baghdasaryan wrote: > > > > On Sun, Sep 1, 2024 at 10:09=E2=80=AFPM Andrew Morton wrote: > > > > > > > > > > On Sun, 1 Sep 2024 21:41:27 -0700 Suren Baghdasaryan wrote: > > > > > > > > > > > Introduce CONFIG_PGALLOC_TAG_REF_BITS to control the size of th= e > > > > > > page allocation tag references. When the size is configured to = be > > > > > > less than a direct pointer, the tags are searched using an inde= x > > > > > > stored as the tag reference. > > > > > > > > > > > > ... > > > > > > > > > > > > +config PGALLOC_TAG_REF_BITS > > > > > > + int "Number of bits for page allocation tag reference (10= -64)" > > > > > > + range 10 64 > > > > > > + default "64" > > > > > > + depends on MEM_ALLOC_PROFILING > > > > > > + help > > > > > > + Number of bits used to encode a page allocation tag ref= erence. > > > > > > + > > > > > > + Smaller number results in less memory overhead but limi= ts the number of > > > > > > + allocations which can be tagged (including allocations = from modules). > > > > > > + > > > > > > > > > > In other words, "we have no idea what's best for you, you're on y= our > > > > > own". > > > > > > > > > > I pity our poor users. > > > > > > > > > > Can we at least tell them what they should look at to determine w= hether > > > > > whatever random number they chose was helpful or harmful? > > > > > > > > At the end of my reply in > > > > https://lore.kernel.org/all/CAJuCfpGNYgx0GW4suHRzmxVH28RGRnFBvFC6WO= +F8BD4HDqxXA@mail.gmail.com/#t > > > > I suggested using all unused page flags. That would simplify things > > > > for the user at the expense of potentially using more memory than w= e > > > > need. > > > > > > Why would that use more memory, and how much? > > > > Say our kernel uses 5000 page allocations and there are additional 100 > > allocations from all the modules we are loading at runtime. They all > > can be addressed using 13 bits (8192 addressable tags), so the > > contiguous memory we will be preallocating to store these tags is 8192 > > * sizeof(alloc_tag). sizeof(alloc_tag) is 40 bytes as of today but > > might increase in the future if we add more fields there for other > > uses (like gfp_flags for example). So, currently this would use 320KB. > > If we always use 16 bits we would be preallocating 2.5MB. So, that > > would be 2.2MB of wasted memory. Using more than 16 bits (65536 > > addressable tags) will be impractical anytime soon (current number > > IIRC is a bit over 4000). > > I see, it's not about the page bits, it's about the contiguous array of > alloc tags? > > What if we just reserved address space, and only filled it in as needed? That might be possible. I'll have to try that. Thanks!