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 9445AC3ABB2 for ; Wed, 28 May 2025 09:06:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33A066B008C; Wed, 28 May 2025 05:06:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3119C6B0092; Wed, 28 May 2025 05:06:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 227856B009D; Wed, 28 May 2025 05:06:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 034F96B008C for ; Wed, 28 May 2025 05:06:46 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 758E91D1B6E for ; Wed, 28 May 2025 09:06:46 +0000 (UTC) X-FDA: 83491736412.05.C7691AC Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf17.hostedemail.com (Postfix) with ESMTP id 714AC4000A for ; Wed, 28 May 2025 09:06:44 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EidPwASP; spf=pass (imf17.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.53 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=1748423204; 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=SrHG2O5BYtb3YtvsVKxTKKGZHaxoCb1RYr5BGkq1In0=; b=BuFjxctmQlaLn1FG664ZEUy2Xp7U7XbxHsj/xURUkcSY2kI4Sbi/xS3tPQsfxkVQolUFSH 4ISagLSvE6yxxPuHnHldM/ZeirbHu1ISY8gBAHTNNyCoBVMaCSR4HDU6BNL3CyPsFi7TYx ywneX0RQ0yGAzZa1bUX/lEPhcWqBXHE= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=EidPwASP; spf=pass (imf17.hostedemail.com: domain of asml.silence@gmail.com designates 209.85.218.53 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=1748423204; a=rsa-sha256; cv=none; b=maQz3/qEb90hppu26rXtuzgwc99YtmYoFUA9xiqDLEB62lDH5+OQzjuDMfBkC9mKX5sk/X Emz+FXPLM9GLuRkI5E6GziAzDm7JKAXaTrZlYnIuxPZZfyhFCuic3Ifaqm3uFbUE+NyhuP LFNwjZnZytxR5fI2DpsgSZJ5o6qH02M= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-ad89333d603so265439266b.2 for ; Wed, 28 May 2025 02:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748423203; x=1749028003; 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=SrHG2O5BYtb3YtvsVKxTKKGZHaxoCb1RYr5BGkq1In0=; b=EidPwASP1SLqWb4SljcTq668s5qwcYsTHo0LQHRhmnAIrMtIRP9PqghUQIaFq+P6Co DBjuNsEsdCP8e0qwFTywxsqE8XnFn5LJ6MCBoozLvfuZVNQV7/JOjpstktJrMLrVq4Lu SSqKzunCjLXYAnaL1azBWQET7xYXQOV9gRJ6ByDUfT556inAaBA5VFq7MpKPELmReL7N nkDThiXyZpM6rB6qaGF2A7cPLnWI3nXlFbslhFO7+PFojsvp6fepNDBRxxDjhVzA97lA wy5pJgCnFcpxed//SZ8LZP/r8ihSKYcU8oUTSW8yeRuUUAZIYl+FvHyijNAMlrR+tv1i +duA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748423203; x=1749028003; 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=SrHG2O5BYtb3YtvsVKxTKKGZHaxoCb1RYr5BGkq1In0=; b=uMhzoj5aDMXytBWbs8DC9NhnaXzGRJNQFQR7UJqaHvrwPBdBaMxTtUO12oCdkkTi6v 5DxZvg9reXvGHPT7XDw0CexXlmQBTNsrWhDTvuZB2gevH3RhXAK1akgtySrsU/bg0atn hhSg9OOOnxGG/61pNGyq+jVOBhugbvhqD8BYnn8ooS13aIOeI247dduTrD1FYiFgwVeR JuB+5doMgdbzfl1jdrSssEhRR4nC0ZH3HLfwxCYhq4l0+AntAj5cs3bPlBPpvdPzptk+ Wuv/FGF2bDqVomS+KPQ75+sWUxZ6aV2YIFdYtw9b8vOqntYAA4EvD6AP7ygXByb8Tlcf V0SA== X-Forwarded-Encrypted: i=1; AJvYcCW1hvTyA4QOEOm9Te+fWSh6qNi8kaZjICGXnLfpEHfZDa7RVb4FobSKCowdzsL2JqFSDZGZc1iCXA==@kvack.org X-Gm-Message-State: AOJu0YzRkfziT1RGqYJYVyJYLJTxH41E9Oxjdr7cs+iUqOEfvtyqXsUN UqSal4DWCQgzKe2q/Wm2l/hUjj90otlr6pNst4YoSSafnMeHWbcCt9T4 X-Gm-Gg: ASbGncsOn/5xjKqPyq/bMCC3h8Ul3cY73DCJq90r0p6CKeVqyXCV4eBDIKdfIRdxsFa mkaV4Iqc3PXcsxOisb9NwcMEWLOr/iCQN13RjZYlnpA6/rksI7ry6MGT7BRfVlQAEzDT1UiJ4py 6ebacNfEUSfXx8V3/Gno8AIO3deQ0xHHJWNgbuxd2g7MzWOwrSjNZsDK487llRr/Xxrg27vxTsE xaTNSkcbw1I1pH4JdIY1wBz5JHHFDjkcBD8KocHvkjhBG4bl540W92Mg4RHarI5SHxdgFSktjih YkDHyfTaHc53708Is/ZV8Onnuu/ImxpA7PQ1q4V2RV9Z6Pscj+q+xjvEDn64hvk= X-Google-Smtp-Source: AGHT+IHlRG59ZQ1RE5LCh+OggOjfsmRsw03O6EaDU9OGsaOzsQR2qjNj3W2GDEZEmVgO/2R9EYjTRQ== X-Received: by 2002:a17:907:8686:b0:ad5:55db:e413 with SMTP id a640c23a62f3a-ad85b1504d9mr1421685166b.26.1748423202406; Wed, 28 May 2025 02:06:42 -0700 (PDT) Received: from ?IPV6:2620:10d:c096:325::6f? ([2620:10d:c092:600::1:c447]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad8a1b29324sm73175966b.100.2025.05.28.02.06.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 May 2025 02:06:41 -0700 (PDT) Message-ID: <06fca2f8-39f6-4abb-8e0d-bef373d9be0f@gmail.com> Date: Wed, 28 May 2025 10:07:52 +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> Content-Language: en-US From: Pavel Begunkov In-Reply-To: <20250528081403.GA28116@system.software.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 714AC4000A X-Stat-Signature: xtrq7hyhqj9gxa3wwp9yk3zexp748smn X-Rspam-User: X-HE-Tag: 1748423204-789815 X-HE-Meta: U2FsdGVkX199NS0xXGXGY2yAHcomtxWijhA37xTC1RSM+uEkbnKCNN7BMC1azCqfSWeEXzdjEOxIsDLD4UKgz98bTWtb79wAwK57opeokuhOzZGsp3aUWu8yRWPdrkC14gehNpUeW+9mNBVURp/8b2nvlQMBKJE0t0wQ0PuP4gp8lnh33e85PdBw9ePc8MXo6SGcyrZqfNS5yE4kEkscPUf63jrIS0uZdyVZHSQrrnabemsIWNV51Qq5hxH32qhtRHtDEvniYYpCXgIu9xPAivt6Vizt+ZZ3yD0DPnFQl91IZoFDZ3uaR5sUdgD5DhswEQLvm7RlX1Voz0CNvv3qNfJbrMIHzYd3Y8msHZhFDvvW2UQxM923G9fD1DDHKz7pOzbL+9j164aOeaUji7Cxt79ydVKflFP9bK/e+qAauLHxL6shQNVaJfQsof+DL6CnpEEimno84gs25kgAsE76vNxxMoJxKN6NETf7duEYItpcXGs+ayUc73RKxDXqEBlAFharM8d4QsRYwjShxWSy45wjZuC9I0m9N0zwaHR3EsMyh5SpI0FkmP7aUAbvMPYHDkq1Sm+gV8RiDRreje76y2fKW8BHCmeHSrko1J1qv/4YzjyY/ndHp+pik6vFlkC3QQ/UqHIJ4+Kgczqw3AjIgBSH+i4VL4pB6PLkGAU2aXq8KfvbHdpLr3NeSxhI1PHrE6i5YpAKTceel2K+CP08Ob9haaViCxSpOLlB4J/v5JdULNAn3KPQ/b4axisuXWsqmBnjFe/1lyBf0fnFHnINCS+7FOwf281/cJIauNubQIKpy2U8ixQBS8XoGtJbYXR5SD7NuFSXnwtig2C7+z7PcDhdVgcauRHy7gDZiwEp9oMEC0+MGh9RaNO4mZ5v8XQNn4eqVTctsUqJ0KJvivXjkUDyhbFJLyVQBfFKjJTccyLmIuPCrpu0q7SIpaYpeoozg4HYKwpIjlPqklTM4V5 kHfOubvM 5E6d8aY0unHvl8zxK8RaagyihR3IFRQppa219kMOx7krxDiln2om9NlOIama9N6355YeKOsgPwuszMkpMiTbddIANvwsqRlvNZPr56JVsYGsJh+nVhfH1BmwB5Ttuge4eSPBeSTV4dJDNFpqvzBUmRqL+emQ+JBAXQBJsP2uX17iarcdqV5hYdsmlvNZ43dH93d2Nd8v2k/KqL4TtKO8GvLiQ8biEFa57Aels3SqwRXWngLfJJ5zxY0LtFpFE3d/dJuVBGxzKXo247jhW9WvI0kFCYxl/4ZnZfdTHkW4MV8zK2V17746ZNiabfr7aTj4WdP0YhHh6nf/+3AKdAC4nEFNok3CnESfvRwJfnpD58OZv7MTXHnDv5OVDbU6n3gBHmEb6iCl5lTP/cKDw3QFqTVVsolvAwl5/KjXX0DwJ+LIvzqbXLtkVUebft7Lh0szoa6DcmsiCE7y0oJSPey1nFmKzb3kYat5IMtkQCyKFiYFktgA6ns78I0RewaL8CxZLytSANHeboEuA7cNVM+VHqhi8bZ4XUEbptbOw/2vTWUKV+UyVaSDkEKTN/ktPy5OFD/ntui3YV/lSyNyRtsvNOjxjkxx5oyilGgGS6QIAAdrPzAiCEzzJM9Hh9B84gugawptPhIXHwtMchMTvGTExc867/Q== 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 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() can continue using page->netmem_desc->pp_magic as before, and mm folks will fix it up to page->type when it's time for that. And the compiler will help by failing compilation if forgotten. You should be able to do the same with the overlay option. And, AFAIU, they want to remove/move the lru field in the same way? In which case we'll get the same problem and need to re-alias it to something else. -- Pavel Begunkov