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 F3D90C5AD49 for ; Wed, 28 May 2025 09:50:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9355C6B0093; Wed, 28 May 2025 05:50:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 90D1A6B0095; Wed, 28 May 2025 05:50:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8250B6B0096; Wed, 28 May 2025 05:50:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 624716B0093 for ; Wed, 28 May 2025 05:50:22 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1C81C1D03EC for ; Wed, 28 May 2025 09:50:22 +0000 (UTC) X-FDA: 83491846284.02.6E631A6 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf05.hostedemail.com (Postfix) with ESMTP id 1BE4710000F for ; Wed, 28 May 2025 09:50:19 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OVvq5c5R; spf=pass (imf05.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748425820; 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=U154eK3ddwaPqm55ZRdw1sQb9SuIUnfO5tNkP86wnH0=; b=JfpkbMFA8ewqIY6g/HznZ508wcvbjdkY1MpBIfNJJ8r0yPJopTU+HTiyKayC/bJsSNesmL 6Oz3eQl+awlaq/Pt+9M0C4l69wlQBH5e5RRGu7cf+HYEkWqmENbPrWTDVqCR4pqPFkIUGb 4B51Rfkf6UIQfEzPJy4kEJYuFAah3+k= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OVvq5c5R; spf=pass (imf05.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=asml.silence@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748425820; a=rsa-sha256; cv=none; b=7Qkh+nqQvW8PY4zHeQSsLwh0xKhmeRZ2VG6j+S/9cYjEUbI+MSembtrDkhX1PHdtnYGqv6 mhVd3jNlMM56hsyVsTtMw2pw4AjhxyGNP6VgJyiwdIjeGwi/SqfHJhiI3OMUhyReKDJ8r9 z+Af0dyTRft+gIhlTeyFFDwaYJUawx0= Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-ad5574b59c0so786368266b.2 for ; Wed, 28 May 2025 02:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748425818; x=1749030618; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=U154eK3ddwaPqm55ZRdw1sQb9SuIUnfO5tNkP86wnH0=; b=OVvq5c5RmiaDUPwB0by4EF4wB/SGPu3GiBqrJJf0npEVg2sJeekN/Rt8EHoITwNuQO hfB9EtPLBAlVtSJXbwjzgVZno2u3t6GvWnyVbfX3kG/U7VeCRxdfLuZN8lThJqDDCS/w RSqajUSNbBQ6XJ2gx+qrQ67hmwnuYloYsuS0Ria8sXCtUstvNFeJqk5zGjcMrFwSu5Q3 wBP7dc3GuaLMKzwMU7sumShzfoX3mNHlU5mUALUXRmVzPUihKpgqGKJROCAJ+tRx9uKF OfTIRTDfXnrST+2BLeO+N/nRVWdA+EttshWex2vMJjmw3Wp4UjAcwCh1qxPoCYKnlmQY VuqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748425818; x=1749030618; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U154eK3ddwaPqm55ZRdw1sQb9SuIUnfO5tNkP86wnH0=; b=Ou3HRXOF53okYx602ZGIZqeoQCR8mXCmvft+1Mk/YxlZcsCM6rTGxzj9mOnIfl670d W5/U7ccFjIdWa/eYtrFy3mvv6WVp/+kRVqc9Y3gMumjVIRowUiZsgVpAI7UJVAzw2Zdx EVtFPWUO4OZ05FhM2JPw6xrCEMAMPuaf1z7gvYtGcr2UelMTS8SUxnjmdaiDNWq3D9KY IImZvm8G2HyIe3b8l80G1WOeh1Db6foOBBVM/V6johrVoQwqELpYPfYZJ2z15NcaMn3F RdvBkQqokmgq5wMdyk3Go+k9ev1JGRtV1RbSyAA70kPH3EkSLyn62YFciD+/rwayaOHF mCow== X-Forwarded-Encrypted: i=1; AJvYcCW51qBCktwenyUdrhAn2XJr+7tpweHs7Tz6ydIVDZfe1h3u+5aHPICncpMsg0ZUN2apb70Xtnn0sA==@kvack.org X-Gm-Message-State: AOJu0YwpBuNpAz4qqybBjTvygDgCypts1vGVjLP7W8oLIYKpJ/7ELy2L IMX5oOPNJ8LGi0I8GlV0OuOzyYyTlboICofKDuBwmH2SJMOi+PF6etD/ X-Gm-Gg: ASbGncvsI2kaDIxO2qAwZ+hYyaXnmn8OP502b6JnVrXxu0sw12HgDfhSWCAuDNSq7D1 F0D9zsRiHgBOfitFirMY/YhrhqwRbTKz7HP6hnsznynqksxLgpgwD01DTN8glscSWocs0UVJFdA RwLH8B3+Y3cNYaiaVsevfxxUJbS3ODxjDMW0lHW6ufuR12d4/VaWIlYEbF3k6Ecf54aeV1+IBFM 2BspXtcXFh3KYGlPvcEiWCYHQDSLaT23QmiviM0HpE1toGhCriDRi9gddC4sBuOefGFYQr/iZdJ zHUNyhLufID5Z9tKaLbaT+k+Aa5YNCaIo2VzYm0HN5mRWcfsKfgEIbuGM0Fr209zBN9cHPwgOQ= = X-Google-Smtp-Source: AGHT+IFBpwXe6OYaA+6pIeCAYnPKbCTjWryXK9Qi9lEDBkg++QM3cSR3IC/BzivItjAiaVNDFa3zmw== X-Received: by 2002:a17:906:c14f:b0:ad8:a4a8:103a with SMTP id a640c23a62f3a-ad8a4a81180mr97835266b.4.1748425818177; Wed, 28 May 2025 02:50:18 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325::6f? ([2620:10d:c092:600::1:c447]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad8a1b28908sm78014966b.117.2025.05.28.02.50.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 May 2025 02:50:17 -0700 (PDT) Message-ID: <5494b37d-1af0-488e-904b-2d3cbd0e7dcf@gmail.com> Date: Wed, 28 May 2025 10:51:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 12/18] page_pool: use netmem APIs to access page->pp_magic in page_pool_page_is_pp() To: Byungchul Park 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 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> <20250528093303.GB54984@system.software.com> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <20250528093303.GB54984@system.software.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1BE4710000F X-Stat-Signature: y159934t7fkqpnxurxwub8imw8aa5ks9 X-Rspam-User: X-HE-Tag: 1748425819-198347 X-HE-Meta: U2FsdGVkX1/80feSRgcuB3VX9CovlyxZyXRc5Y04lvUrakq4mbkS2oIB9RSpvlWh6X/C06Bf7AA1hJg53+QsyFdKn2iBa5cGdNBDufLfcpNhTyKqzfsKq5v7uMcwIn+Ti53cpd08pJ9OLNri+AwjP5V7EEnRP3j9xsDB5vZ4JZwOioVX20VYSw47qCMXle+sGlXi5N6VKAQu8UPi+WbfH6p9vUtSEWqy+18n1deL37a8jRbYeYGNS5nNGz95AF8hScrx2cmOlj6toudXnzfONygsOplzd4tHUsyWQN1s3pnHKCP64ZSlHl/YAQfU7zseC7KFfgRhStEgIg5b1YNM2gbC5qPJ268hNjEWAhPXo0h45ChZoaXPzQu7TVvJKolyMgH5kKqpyNKPZtfdgIG0GiYqUD6DQhOjUBjfDy/m+0tl+GcET3CbwZoF9tM1R0aSeGBuBJn8AEPmD+7UbaAMe1489bd9T9rRcpgp3WB19ZUHs3lkL3oEjmRGJO7LJ6UdAkXXBzmQd06c9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RBiQm9tsuRZsQl55zJxkduzUKfO7fbXA3t+CtVENHP7wKQ60tispq979axXOapfsrqz9z+gRSwZ2ZNkH6pASxnMKaSI/iOtLsEZtrrcUktI5WzmX/ff/yR2pAjzogdLiI= 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 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.". 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