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 B6BF6C3ABB2 for ; Wed, 28 May 2025 10:44:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52D296B0082; Wed, 28 May 2025 06:44:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DEFA6B0083; Wed, 28 May 2025 06:44:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A69A6B0088; Wed, 28 May 2025 06:44:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 191C86B0082 for ; Wed, 28 May 2025 06:44:51 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B4BCDBBD0A for ; Wed, 28 May 2025 10:44:50 +0000 (UTC) X-FDA: 83491983540.30.B1EFF72 Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by imf09.hostedemail.com (Postfix) with ESMTP id 0142D140011 for ; Wed, 28 May 2025 10:44:47 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748429089; 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; bh=fSHNAVF7j68cYsCzpQaK/2wPiydRoQFAx/pUcmoGc9s=; b=qXmU5KLQYQjTcqqwQIH5ESssiLDLUa2+NkS8G6pVLkkJkPHFugNy6fULipRTBG4SChGZOV 1tAqVVZtm83f91r8XD9MhzZH3WGbYbAHJFVJCXED3vWULfnVptILjz428iwiBH7nBM3WO2 Vh9nWZWPfcniIVR6ggiwOPBZr3fjEz4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748429089; a=rsa-sha256; cv=none; b=Ila158ItAYSHdzmghdXPrFl/0RBOrAVMjE/S+ocDZfYx7xm7zbPrVqSY8UGmeMd6NrW8zg XgkYEcMQZlgJ/Xx71r23hr46+X611oxz7vBqDFA+iFK7b5DRzoEyCpCQXhkpIoYfgVjGmB RSVfewxESbuA8+PKcOFM8B6pD5YjJOk= X-AuditID: a67dfc5b-669ff7000002311f-12-6836e91d5aa2 Date: Wed, 28 May 2025 19:44:40 +0900 From: Byungchul Park To: Pavel Begunkov Cc: Mina Almasry , willy@infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, kuba@kernel.org, ilias.apalodimas@linaro.org, harry.yoo@oracle.com, hawk@kernel.org, akpm@linux-foundation.org, davem@davemloft.net, john.fastabend@gmail.com, andrew+netdev@lunn.ch, toke@redhat.com, tariqt@nvidia.com, edumazet@google.com, pabeni@redhat.com, saeedm@nvidia.com, leon@kernel.org, ast@kernel.org, daniel@iogearbox.net, david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, horms@kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, vishal.moola@gmail.com Subject: Re: [PATCH 12/18] page_pool: use netmem APIs to access page->pp_magic in page_pool_page_is_pp() Message-ID: <20250528104440.GA13050@system.software.com> References: <20250523032609.16334-13-byungchul@sk.com> <20250526022307.GA27145@system.software.com> <20250528081403.GA28116@system.software.com> <06fca2f8-39f6-4abb-8e0d-bef373d9be0f@gmail.com> <20250528091416.GA54984@system.software.com> <20250528093303.GB54984@system.software.com> <5494b37d-1af0-488e-904b-2d3cbd0e7dcf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5494b37d-1af0-488e-904b-2d3cbd0e7dcf@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA02SWUwTURSGc2emd6aVxktduErc6oJLXIPmxD0a441xjQ9GTdAGRlstYIog IBoEjBELbiRiLVhRERBSU6UsqUYrIkbjUkUrLhhU1OAKWkUUpSVG3r7858/5zsOReE2BYqBk iNkqm2J0Ri1WCaoPQQXjB72bpp/0+dB4sNpLMZz9kQhnXlQqwFriRPC1/YkIbTXXMZw84ePB eidDgG/2nzy8rm0SobGwWQDXngoemvbXYcjK6OAhrbKIg7vObAXk/DzNQ0XqCxHuV1sxPC/9 o4Bmd5YANyzFAjRmz4VaW3/w3XyPoMZewYHPnIfhsMeG4WVGIwLP1SYBju3KRmC/5FVAxw8r njuMXSh+zLEqyzOR2Rzx7HzRWJbp9fDMUbIXM0frIZE9fejCrC63Q2BVlW0cy0r/iNmX1w0C +3SpHjP7hXqB3bLViKzNMXg5WaOaGSUbDQmyaeLs9Sq9q/wI2nIxLDGn+i1ORfmDMpFSoiSc mluOiJlICrA3ba0/FshImtuex/sZkzDq9bYHuC8ZR1seubvqKokn7xXUvscp+Ad9yCZqbniD /awmQFtqSzg/a8hugZrNS7vzYHrj6KtAn+9a+ivfw/u9PAmlZzql7ngITS8/FnApySya/r0z sKYfGU4vO69zfi8lLon6PB/47vsH0CtFXuEACrb0UFh6KCz/FZYeChsSSpDGEJMQrTMYwyfo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qVScmOTUiZSJGiTYmwIc7TcTZq6I0gpk0Yqkk4KmtgITXy0oLUhd46Rr5Lu 3i8ckfFRihPCcUGIEzT/WopzWZ2MvDWXfEOu4Kjz4Xz+wZChpliLcbz/cOGQjg3YF38rVLIk ojjCc+190jDY4z+3y2fn7ddFSasCDnz6Hu63ufzR6SrfoZ7coC95LftHvfz7H4QWXppta21f Yg07nRI8Uj4zfrc4PtBaFZGZYgk077WukKkfbaA8Ayuu7gnvq/zg4b3DLme0SsXG9bRGq/gD 47EkOBgDAAA= X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Queue-Id: 0142D140011 X-Rspamd-Server: rspam09 X-Stat-Signature: h8qq57fcqaxea1z75w7xdnew3etnkgxt X-HE-Tag: 1748429087-561700 X-HE-Meta: U2FsdGVkX186+Puzs+1upuHiZydDR2DVoHqcgGYu+C5gsPDyygWF0gY/qWCU4Ocwa1YYyE1W87IDQHtPAELza9gr7cTAOTXKVlZoMMyblmfN+CqrCbi2fPc5VEgYpFQ2Em2KZpPxjFtLLTq3jXmS/7lOYLPwKvuOCncbKHEhoV+iDClTuyF6C3j5raG97f/Jpw8N1QG+l/DSIp0V0FMIslyr2RBrijNMqKWUU7s/4VcqNFdxFlXlaH3jz5XVhtfmQVmcgiEIzPpLElp8BHdxmVle26uh4YhRKhiETyplxtXovHwAHKrEcsq6Sr+pyUaB1mttLnasXebw6R6mVEajjZw64GR5U2aXj9PSurK529/WNrIgOJvbKlkomQjjR1DGPYDMla8cANW5wZYAvKOhN6iGHcTiUuACgrg8s/v6gVt6nJoYLgwfkkyl0wtHLz4lYJefAKoeS3NajKf0klMkvihkXCt2RxUvVvUpBDi66BRv9MQXNqNGXjvBgy0GrUYv3NSVzti9GQEjthsZhQCvK9ZUOtVj7DttOPBF9w0BWOkmVPKDQJGNnj47h23ziF1Sifw9ldFqo7tDd8yHCWJmO483Twf4ziHdR1SPwQ/o76rtIirHuZpaeYWNHnzZNOwW0zZE+pndZ88oKmFbIdH8kOS0mBnssfBEmN4XZMp5dFR/d81QELhByquAbqBdO/k1L3dVxMnS9hcuXT/b7XCQU4pw/nA8lJFeXoT3+AxSKTumCVKrUo0qRZ5e9vMdKujGyJmCARbL8onMhKOtdQ6lWMbWaK9t9dLk17J2CqsB844UquGjACrr9WgBNsxWy3ltMDnXXc3PfdNW+TMK5ieqdDCWQe+g8gXSGSpIGlJlqHPt9F6laEe3cKmCr01Da/0rYo0KD1j/x+4CkJgGJF7QZCwQ3hW0Jw5veMptZ+wCj8cy8vfphWpwi7nE66uuPp9R/mYYDm/R9JIMGXrTjNv YF22lbYB YZu5JXpk8eaA9xYQbyCxMsKYMdsYGmPKFEzdYD0FdVPMJcdOBPExSEOJ5zoqkZxFKZsBYBV88xIsENu0CJn0U5nUkOqG8u5bSVibLwJ2NxKte+UK0tl87j1LXjrdCMXpJl9rJLYRaxhwBk/zoD1MTED4qdtLJUB5cvPy4pUXqLx0sP86bFjZtu0KOmfWtew8AZTKXsdCHAjJH1g0mmVUeGu0rD1/Cqonu1wkqbMJWO9duDWI= 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, May 28, 2025 at 10:51:29AM +0100, Pavel Begunkov wrote: > On 5/28/25 10:33, Byungchul Park wrote: > > On Wed, May 28, 2025 at 10:20:29AM +0100, Pavel Begunkov wrote: > > > On 5/28/25 10:14, Byungchul Park wrote: > > > > On Wed, May 28, 2025 at 10:07:52AM +0100, Pavel Begunkov wrote: > > > > > On 5/28/25 09:14, Byungchul Park wrote: > > > > > > On Wed, May 28, 2025 at 08:51:47AM +0100, Pavel Begunkov wrote: > > > > > > > On 5/26/25 03:23, Byungchul Park wrote: > > > > > > > > On Fri, May 23, 2025 at 10:21:17AM -0700, Mina Almasry wrote: > > > > > > > > > On Thu, May 22, 2025 at 8:26 PM Byungchul Park wrote: > > > > > > > > > > > > > > > > > > > > To simplify struct page, the effort to seperate its own descriptor from > > > > > > > > > > struct page is required and the work for page pool is on going. > > > > > > > > > > > > > > > > > > > > To achieve that, all the code should avoid accessing page pool members > > > > > > > > > > of struct page directly, but use safe APIs for the purpose. > > > > > > > > > > > > > > > > > > > > Use netmem_is_pp() instead of directly accessing page->pp_magic in > > > > > > > > > > page_pool_page_is_pp(). > > > > > > > > > > > > > > > > > > > > Signed-off-by: Byungchul Park > > > > > > > > > > --- > > > > > > > > > > include/linux/mm.h | 5 +---- > > > > > > > > > > net/core/page_pool.c | 5 +++++ > > > > > > > > > > 2 files changed, 6 insertions(+), 4 deletions(-) > > > > > > > > > > > > > > > > > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > > > > > > > > > index 8dc012e84033..3f7c80fb73ce 100644 > > > > > > > > > > --- a/include/linux/mm.h > > > > > > > > > > +++ b/include/linux/mm.h > > > > > > > > > > @@ -4312,10 +4312,7 @@ int arch_lock_shadow_stack_status(struct task_struct *t, unsigned long status); > > > > > > > > > > #define PP_MAGIC_MASK ~(PP_DMA_INDEX_MASK | 0x3UL) > > > > > > > > > > > > > > > > > > > > #ifdef CONFIG_PAGE_POOL > > > > > > > > > > -static inline bool page_pool_page_is_pp(struct page *page) > > > > > > > > > > -{ > > > > > > > > > > - return (page->pp_magic & PP_MAGIC_MASK) == PP_SIGNATURE; > > > > > > > > > > -} > > > > > > > > > > > > > > > > > > I vote for keeping this function as-is (do not convert it to netmem), > > > > > > > > > and instead modify it to access page->netmem_desc->pp_magic. > > > > > > > > > > > > > > > > Once the page pool fields are removed from struct page, struct page will > > > > > > > > have neither struct netmem_desc nor the fields.. > > > > > > > > > > > > > > > > So it's unevitable to cast it to netmem_desc in order to refer to > > > > > > > > pp_magic. Again, pp_magic is no longer associated to struct page. > > > > > > > > > > > > > > > > Thoughts? > > > > > > > > > > > > > > Once the indirection / page shrinking is realized, the page is > > > > > > > supposed to have a type field, isn't it? And all pp_magic trickery > > > > > > > will be replaced with something like > > > > > > > > > > > > > > page_pool_page_is_pp() { return page->type == PAGE_TYPE_PP; } > > > > > > > > > > > > Agree, but we need a temporary solution until then. I will use the > > > > > > following way for now: > > > > > > > > > > The question is what is the problem that you need another temporary > > > > > solution? If, for example, we go the placeholder way, page_pool_page_is_pp() > > > > > > > > I prefer using the place-holder, but Matthew does not. I explained it: > > > > > > > > https://lore.kernel.org/all/20250528013145.GB2986@system.software.com/ > > > > > > > > Now, I'm going with the same way as the other approaches e.g. ptdesc. > > > > > > Sure, but that doesn't change my point > > > > What's your point? The other appoaches do not use place-holders. I > > don't get your point. > > > > As I told you, I will introduce a new struct, netmem_desc, instead of > > struct_group_tagged() on struct net_iov, and modify the static assert on > > the offsets to keep the important fields between struct page and > > netmem_desc. > > > > Then, is that following your point? Or could you explain your point in > > more detail? Did you say other points than these? > > Then please read the message again first. I was replying to th > aliasing with "lru", and even at the place you cut the message it > says "for example", which was followed by "You should be able to > do the same with the overlay option.". With struct_group_tagged() on struct net_iov, no idea about how to. However, it's doable with a new separate struct, struct netmem_desc. I will. Byungchul > > You can still continue to use pp_magic placed in the netmem_desc > until mm gets rid of it in favour of page->type. I hear that you're > saying it's temporary, but it's messy and there is nothing more > persistent than a "temporary solution", who knows where the final > conversion is going to happen. > > -- > Pavel Begunkov >