Message ID | 20221021025822.64381-1-linyunsheng@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp454362wrr; Thu, 20 Oct 2022 20:11:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ig6nNbUVWsT98nPs9+VXs2kxprV72QyNKHdoCFLXcgzghUfswbbXs5G1WNq0VY1xwWYmK X-Received: by 2002:a50:85ca:0:b0:461:168c:83ab with SMTP id q10-20020a5085ca000000b00461168c83abmr3812390edh.359.1666321860105; Thu, 20 Oct 2022 20:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666321860; cv=none; d=google.com; s=arc-20160816; b=qX4dZ0sMIRlX5HoCjePpDc/VhFnTYQeu0fbN4FKXigzynO+EWx3tb0Xd98pWA1VBRv p+8KkYElRw4HjAUJPJhMb1AA/LxC2lxwbMWB0cbOm4PU7NYGTdRx58W6p1vBGnRxaEt5 IfuxdThXcOVja1QIky+iHPgagY2B+4daitWlplSZQyefDGA9LKC05KDm1Uvjh6F9uvme yYSALtp5YsEg9t4tXv6h7d9aKekS/plGyEqUfdCTOkctXNnedliOtdbWO3Qf/5sknk9/ kSpWU0uRV1kp67uhkzIx9WvAi7x45FRqmG8P8FX15fw5sl6nWr4sH6Uqw7SeMSKjK+k4 LzYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Jz/QGCBJYTLNqK2OcpcypaK9VeQp1ZPRfbo8dcn5THE=; b=zVIrj3Nk/Umsv8Jd8SEZ61mgvdIga56XQZh+DFY9pcMEBEpMFZrJCwXqqn17q2XuAc +KGn/0/U7FW4xvE5ehbvBKxr+plca3nvGvsasJzMPDyOe1E4VA1cVcLOyQFTyTd+fGOR CH0kUdGkHGJR1d4nVUAV0h3ea+N1Zboe9DfwxfqIv1GLrFq5frsLyXNf/KLB/2/lFYBa zS/tCSxsphovJhsgFPEeNTnI7uUUcxk5187TKV3gUrSqW8wmT0u1DZ7sbrwmLhdNjMUz Y6RaPvi20ah7CwvWaLR1BgIZdOEpHORBUQsHTtwkdHRrALpjMead2HT2x0Sqswe5zsll 6fGg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a056402400200b0045d02b75b4csi18191358eda.519.2022.10.20.20.10.35; Thu, 20 Oct 2022 20:11:00 -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 S229828AbiJUC6G (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Thu, 20 Oct 2022 22:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiJUC6F (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Oct 2022 22:58:05 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD77F1BC148; Thu, 20 Oct 2022 19:58:03 -0700 (PDT) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mtq004NnkzHvDj; Fri, 21 Oct 2022 10:57:52 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 21 Oct 2022 10:57:39 +0800 Received: from localhost.localdomain (10.69.192.56) 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.2375.31; Fri, 21 Oct 2022 10:57:39 +0800 From: Yunsheng Lin <linyunsheng@huawei.com> To: <davem@davemloft.net>, <kuba@kernel.org> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linuxarm@openeuler.org>, <pabeni@redhat.com>, <hawk@kernel.org>, <ilias.apalodimas@linaro.org> Subject: [PATCH net-next] net: skb: move skb_pp_recycle() to skbuff.c Date: Fri, 21 Oct 2022 10:58:22 +0800 Message-ID: <20221021025822.64381-1-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] 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.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747265110274277409?= X-GMAIL-MSGID: =?utf-8?q?1747265110274277409?= |
Series |
[net-next] net: skb: move skb_pp_recycle() to skbuff.c
|
|
Commit Message
Yunsheng Lin
Oct. 21, 2022, 2:58 a.m. UTC
skb_pp_recycle() is only used by skb_free_head() in
skbuff.c, so move it to skbuff.c.
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
include/linux/skbuff.h | 7 -------
net/core/skbuff.c | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
Comments
Hi Yungsheng On Fri, 21 Oct 2022 at 05:58, Yunsheng Lin <linyunsheng@huawei.com> wrote: > > skb_pp_recycle() is only used by skb_free_head() in > skbuff.c, so move it to skbuff.c. > > Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> > --- > include/linux/skbuff.h | 7 ------- > net/core/skbuff.c | 7 +++++++ > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index 9fcf534f2d92..28a7b5fbc7b7 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -5048,12 +5048,5 @@ static inline void skb_mark_for_recycle(struct sk_buff *skb) > } > #endif > > -static inline bool skb_pp_recycle(struct sk_buff *skb, void *data) > -{ > - if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) > - return false; > - return page_pool_return_skb_page(virt_to_page(data)); > -} > - > #endif /* __KERNEL__ */ > #endif /* _LINUX_SKBUFF_H */ > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > index 1d9719e72f9d..9b3b19816d2d 100644 > --- a/net/core/skbuff.c > +++ b/net/core/skbuff.c > @@ -748,6 +748,13 @@ static void skb_clone_fraglist(struct sk_buff *skb) > skb_get(list); > } > > +static bool skb_pp_recycle(struct sk_buff *skb, void *data) > +{ > + if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) > + return false; > + return page_pool_return_skb_page(virt_to_page(data)); > +} > + Any particular reason you are removing the inline hint here? Doing it like this will add an extra function call for every packet (assuming the compiler decided to inline the previous version) Thanks /Ilias > static void skb_free_head(struct sk_buff *skb) > { > unsigned char *head = skb->head; > -- > 2.33.0 >
On Fri, 21 Oct 2022 09:02:36 +0300 Ilias Apalodimas wrote: > > +static bool skb_pp_recycle(struct sk_buff *skb, void *data) > > +{ > > + if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) > > + return false; > > + return page_pool_return_skb_page(virt_to_page(data)); > > +} > > Any particular reason you are removing the inline hint here? It's recommended in networking to avoid using the inline keyword unless someone actually checked the compiler output and found the compiler is being stupid. I don't know the full history of this recommendation tho. > Doing it like this will add an extra function call for every packet > (assuming the compiler decided to inline the previous version) Should be fine, tiny static function with one caller, I'd bet it's always inlined, even with -Os.
Hi Jakub On Fri, Oct 21, 2022 at 08:51:38AM -0700, Jakub Kicinski wrote: > On Fri, 21 Oct 2022 09:02:36 +0300 Ilias Apalodimas wrote: > > > +static bool skb_pp_recycle(struct sk_buff *skb, void *data) > > > +{ > > > + if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) > > > + return false; > > > + return page_pool_return_skb_page(virt_to_page(data)); > > > +} > > > > Any particular reason you are removing the inline hint here? > > It's recommended in networking to avoid using the inline keyword > unless someone actually checked the compiler output and found the > compiler is being stupid. I don't know the full history of this > recommendation tho. > Ah thanks, didn't know that. IIRC there was no particular reason. Probably because the majority of the functions in that header are static inlines. > > Doing it like this will add an extra function call for every packet > > (assuming the compiler decided to inline the previous version) > > Should be fine, tiny static function with one caller, I'd bet it's > always inlined, even with -Os. Well it's compilers -- I wouldn't bet, but fair enough Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Thanks /Ilias
Hello: This patch was applied to netdev/net-next.git (master) by David S. Miller <davem@davemloft.net>: On Fri, 21 Oct 2022 10:58:22 +0800 you wrote: > skb_pp_recycle() is only used by skb_free_head() in > skbuff.c, so move it to skbuff.c. > > Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> > --- > include/linux/skbuff.h | 7 ------- > net/core/skbuff.c | 7 +++++++ > 2 files changed, 7 insertions(+), 7 deletions(-) Here is the summary with links: - [net-next] net: skb: move skb_pp_recycle() to skbuff.c https://git.kernel.org/netdev/net-next/c/4727bab4e9bb You are awesome, thank you!
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9fcf534f2d92..28a7b5fbc7b7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -5048,12 +5048,5 @@ static inline void skb_mark_for_recycle(struct sk_buff *skb) } #endif -static inline bool skb_pp_recycle(struct sk_buff *skb, void *data) -{ - if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) - return false; - return page_pool_return_skb_page(virt_to_page(data)); -} - #endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */ diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 1d9719e72f9d..9b3b19816d2d 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -748,6 +748,13 @@ static void skb_clone_fraglist(struct sk_buff *skb) skb_get(list); } +static bool skb_pp_recycle(struct sk_buff *skb, void *data) +{ + if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) + return false; + return page_pool_return_skb_page(virt_to_page(data)); +} + static void skb_free_head(struct sk_buff *skb) { unsigned char *head = skb->head;