From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95C9D1DF27D; Wed, 28 May 2025 09:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748424797; cv=none; b=Qgi/DRcuy9Qb8RWvfq3sEhQo2yVeFd46LsBvBxeut0UHl+qircv1QrgrLSzh5nKNru+XzIWHp6WkuDGwc6xm4CI3xRu2egukjl63fFMV1jQ/e09vs6iC5ek+IYX9HsTAre+TZTqfCFZuvlLnM+xt1GmeJ5VHdn+4RbGenx2hx5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748424797; c=relaxed/simple; bh=CfPnfHr9W94nu2DOrAYlWE0gmLEjs2BufMiWiQgXfQg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WzfSjXEageBDoiaSIoSJ/+CAhb04droElvPH+HI0EIzyksd3FMRNQwIqLrW9Su0FsIrVk8njFbDWue96N4PyQiIUCkafqrkIVT+XnGFAE5eULaCeD0a4cbEuF9dkArzxn6w0i4EmoEGHUqXrtPqjRDGXyjrESjvWFpPX8Y/a7qE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-669ff7000002311f-ab-6836d855b221 Date: Wed, 28 May 2025 18:33:03 +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: <20250528093303.GB54984@system.software.com> References: <20250523032609.16334-1-byungchul@sk.com> <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> Precedence: bulk X-Mailing-List: linux-rdma@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: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUzMcRzHfX+/3/3u163bfk7xVebhEMsIUR/P/WXffzyMsWHi6Dd3XFeu B6WxpEm3inka1+EwerJdTt1dHhrnUi1LzuIilZBZqZRu1UXcNdN/773fn8/79fnjw9Gym6Ig TqVJFLQahVrOShjJd/+bC7e5IpSLSzMngcF0l4WSwRQoaLOJwFBsQfBz6L0Y+h3VLNy64abB 8DKTgQHTMA1fnreLofVOBwOPsqw0tJ+pYSE300NDhq2QggZLngguDN+mwZreJobXDwwstNwd FUGHPZeBWn0RA615UfDcOBncdV0IHCYrBe6cqyycdxpZ+JTZisD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ypKO PiXFVcWfCFyj/SrE+oo4XFnkizOtFhJXlNyjccXsIyH+0veGxq3PVihcY5ojcFbaJI1nbJ8p PFXXS+MXP6YJbKjqpXCHvkl4wTVUdOwaH6GI55V+J8JF8tbxASLmnVdCYctTlIzm3DMRw3Cs Pzc7HZeJnBiK9ebqphYIR6bZfZzVaicd2Y3dz41/NAszkYgh2QkBZ1BXUw6wg73B3f88Rjuy mAXOrG7YGJKwnSRnLG8jNoEr15bzfWOBXLeu5ltIx2GS9eQKfzOb9R4u7XXuRu3EHueKXzk7 6p3sXq6huoXQIBftFpF2i0j7X6TdItIjqgS5KaLiI2WKiICDqpvyxChFwsGr0ZEVaP05Cu6s PjSh+Z5gM2IZJHUW4/IAuUQgi1clRpoRx5BSN3HqyUC5RHxNlniLV0aHKeMieJUZeTKU1EN8 NoQPl7DXZbH8TZ6P4ZX/KME47U5G52pH8lI0tqCq0G9r6HRMQvlPe0+ID6/xudSV4moN8u62 5FROX5kKztPVj9FDBuRT6nHGfOdo/Yz7bPpbYtw/6cj7XX1rS2H2krSMqe02Ineho/P2tsDT 4mCvXx014S6u/SuT3caMXV6rRXv9SmfaNR8YWwB99NPl9qR8F3WRUUqp5LLDvqRSJfsLmbvC rxgDAAA= X-CFilter-Loop: Reflected 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? Byungchul > > -- > Pavel Begunkov