Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2344109rwb; Sat, 29 Jul 2023 05:14:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlFiVtvcYv5/xfKT6TIXSrvrvHVTiKW1RpIledrffVQInwIP9U1JaetVXNMsrvH/TR0sNAqa X-Received: by 2002:a17:906:3149:b0:991:b554:e64b with SMTP id e9-20020a170906314900b00991b554e64bmr2096602eje.54.1690632852819; Sat, 29 Jul 2023 05:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690632852; cv=none; d=google.com; s=arc-20160816; b=CD1zSagtl65og81OneUHeMXoRQ/IiQk8fBcQ7i2/Mr+S8976m7+VGzvcODggVZLkHu QImvN5tOvZ1EXqYTHsKRjxReEOiIqgfoTfJvD5JqVievROj5EBn59FRXKqZeBu1at3TW LyNoWLIOd48e/oOLOxS7L+yAeOcCMY6Cmhs3qYQ4bKlWCZ+eofy4gznR4uAceVCHlgD7 zcWeFAIbVCDICnzJQaO9JEeupg8unsmBBiGH8wmXRllDbvfWHBXXvwsGTZqwtIRLFnd1 qB1rzaKgv+Go1eO1FR4eE/7nIpnUYqcFrcAMvWBeQxsS+Vy1yZPtHBlY8CJr0rXMaZf7 SKVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=G2U5f7VfH0QHuVvOsbM3XxFBJj8o0JsS+MUWwn4YI3A=; fh=y6eT55y7sywPcRe1liUgm4npLz18zD3ECrznAeqJlH8=; b=jiS1YmpcMs6k3fFDM0ptu2U3h9BgNTNw73BdJSFN28VyE6b72CcOZGULs8O52iMLyQ 97Ehzw/E+syYvq5LiTGhS166Jfl4wy+yEf+6S8yW3vYyzy3g+w0RE5rDvw2p6C54hXHu 3tyShj42fmDC2/C69gSPWpB1FTOeqjFIn8936vNGlK6U1p7POHrWa8Lxi6/sUDnilVoB V9cbyymzC/YTYEqT5GwiImzMA4+p+TOIIzuIYkZJuwhQyz1XMdvtDg5lm+4P+Ug+jwOe aSAZtvDMdaQSVnsDPJtRP5klmn2tvZs6PUHj/jx1of9a9s3Vrv5tV3EKmMjWCWZOU2XT Uzvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020aa7db5a000000b00521e517352esi272567edt.255.2023.07.29.05.13.46; Sat, 29 Jul 2023 05:14:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231320AbjG2Lk0 (ORCPT + 99 others); Sat, 29 Jul 2023 07:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbjG2LkZ (ORCPT ); Sat, 29 Jul 2023 07:40:25 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B229E4B; Sat, 29 Jul 2023 04:40:23 -0700 (PDT) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RCjD60fflzLnvl; Sat, 29 Jul 2023 19:37:42 +0800 (CST) Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Sat, 29 Jul 2023 19:40:20 +0800 Subject: Re: [PATCH net-next 2/9] net: skbuff: don't include to To: Alexander Lobakin CC: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maciej Fijalkowski , Larysa Zaremba , Alexander Duyck , Jesper Dangaard Brouer , Ilias Apalodimas , Simon Horman , , References: <20230727144336.1646454-1-aleksander.lobakin@intel.com> <20230727144336.1646454-3-aleksander.lobakin@intel.com> <5ba84af2-51d1-de5d-14cc-752c08e5371f@intel.com> From: Yunsheng Lin Message-ID: <5830338c-d025-2fb8-46a6-58508493b2cf@huawei.com> Date: Sat, 29 Jul 2023 19:40:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <5ba84af2-51d1-de5d-14cc-752c08e5371f@intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/28 21:58, Alexander Lobakin wrote: > From: Yunsheng Lin > Date: Fri, 28 Jul 2023 20:02:51 +0800 > >> On 2023/7/27 22:43, Alexander Lobakin wrote: >>> diff --git a/net/core/skbuff.c b/net/core/skbuff.c >> >> ... >> >>> +bool page_pool_return_skb_page(struct page *page, bool napi_safe) >> >> Still having the 'page_pool_' prefix seems odd here when it is in the >> skbuff.c where most have skb_ or napi_ prefix, is it better to rename >> it to something like napi_return_page_pool_page()? > > Given that how the function that goes next is named, maybe > skb_pp_return_page() (or skb_pp_put_page())? skb_pp_put_page() seems better. And I like napi_pp_put_page() with 'napi_' prefix better as it does not take a skb as parameter and the naming is aligned with the 'napi_safe' parameter. > >> >>> +{ >>> + struct napi_struct *napi; >>> + struct page_pool *pp; >>> + bool allow_direct; >>> + >>> + page = compound_head(page); >>> + >>> + /* page->pp_magic is OR'ed with PP_SIGNATURE after the allocation >>> + * in order to preserve any existing bits, such as bit 0 for the >>> + * head page of compound page and bit 1 for pfmemalloc page, so >>> + * mask those bits for freeing side when doing below checking, >>> + * and page_is_pfmemalloc() is checked in __page_pool_put_page() >>> + * to avoid recycling the pfmemalloc page. >>> + */ >>> + if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE)) >>> + return false; >>> + >>> + pp = page->pp; >>> + >>> + /* Allow direct recycle if we have reasons to believe that we are >>> + * in the same context as the consumer would run, so there's >>> + * no possible race. >>> + */ >>> + napi = READ_ONCE(pp->p.napi); >>> + allow_direct = napi_safe && napi && >>> + READ_ONCE(napi->list_owner) == smp_processor_id(); >>> + >>> + /* Driver set this to memory recycling info. Reset it on recycle. >>> + * This will *not* work for NIC using a split-page memory model. >>> + * The page will be returned to the pool here regardless of the >>> + * 'flipped' fragment being in use or not. >>> + */ >>> + page_pool_put_full_page(pp, page, allow_direct); >>> + >>> + return true; >>> +} >>> +EXPORT_SYMBOL(page_pool_return_skb_page); >>> + >>> static bool skb_pp_recycle(struct sk_buff *skb, void *data, bool napi_safe) > > (this one) > >>> { >>> if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) We may need the 'IS_ENABLED(CONFIG_PAGE_POOL' checking in the newly moved function too. >>> > > Thanks, > Olek > > . >