Message ID | 20231113130041.58124-5-linyunsheng@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1182568vqg; Mon, 13 Nov 2023 05:01:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6sY/roDcnie40Bu7XiKMHQVxAf1ihXH0vglVWjiuvTqQU7kRCFAK2ibiTBnDgf3IaFU7/ X-Received: by 2002:a05:6808:23d0:b0:3b2:f5be:4fd5 with SMTP id bq16-20020a05680823d000b003b2f5be4fd5mr7534994oib.14.1699880493645; Mon, 13 Nov 2023 05:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699880493; cv=none; d=google.com; s=arc-20160816; b=cXHokJ/zTqYBdT7rzdarjGHN2mZBohq0xs2PejY3tyvJOhx8yfz5t+X6jHEzfkZLye FSnCrPJZn/U6Vin+B0JcoCh6zq0J53Bu+C2t5sShledMxpO6UhRW3SviSiOgmzE30o/+ 9+MNpRu5jSgxYAF7Mf2WeaoDPKRq7/l1fLFQm4GqHgZysd1/CadK1AGvjV9kQeoqVm8f MYeFrAEJssU9JePUpCO+3plXIrDP2uq3UYoMHV7TaYz0AlEwXdBST4ay5Q895ei294xI TfNOOA94h0ECG/7dYomNCJFvclWOTvY4omVcbaTjdFbrxCaZkhBbWmtby8BDSFUjNPQ/ GKww== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=s3ToAF9lPk5lV5aeLAhUsNkuFJwiyqjfy4ZK1ZXiH0w=; fh=rpgd+rBTFhv/UVUrKvI/g1qH621dbxAWhcUv71ig/BU=; b=N3iAIfPdhqfrFzKa2P4spxry65d/IG3Y/vYleFCiHZcFNUaOtQAvBKegZpzDcCHMAv wOfXboJr35vAwNKXXYbjI9rOMUWdwPa1ukIM0Ml86f9I0AmCZOlgtZyVU+7KABiXt06i 3AbbrSzRmsk64MKJ8XV7zictqxHXWN7F8vzf8d2uqCodf643/ahJySk91mUc0S9YwQVm s8sKfL/pAGusSLrJbLYZH9jVk1X/ZF4o0HA0HbzyH2GvVjXE8nmq1730437lwRTzRKwz kpyMDUDUGRIxPckk9Lsi7ttvYaLYgzyWS0Msr6XZSEWC0uC8s6VYYeNUDMyOaPrNI16a VOZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id u192-20020a6379c9000000b005b3e61af56esi5432741pgc.121.2023.11.13.05.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 05:01:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3A9158056982; Mon, 13 Nov 2023 05:01:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjKMNBA (ORCPT <rfc822;heyuhang3455@gmail.com> + 29 others); Mon, 13 Nov 2023 08:01:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbjKMNAn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Nov 2023 08:00:43 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC701984; Mon, 13 Nov 2023 05:00:38 -0800 (PST) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STTwZ5Mryz1P8HW; Mon, 13 Nov 2023 20:57:18 +0800 (CST) 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.2507.31; Mon, 13 Nov 2023 21:00:35 +0800 From: Yunsheng Lin <linyunsheng@huawei.com> To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Yunsheng Lin <linyunsheng@huawei.com> Subject: [PATCH RFC 4/8] skbuff: explicitize the semantics of skb_frag_fill_page_desc() Date: Mon, 13 Nov 2023 21:00:36 +0800 Message-ID: <20231113130041.58124-5-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231113130041.58124-1-linyunsheng@huawei.com> References: <20231113130041.58124-1-linyunsheng@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 13 Nov 2023 05:01:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782453888435751010 X-GMAIL-MSGID: 1782453888435751010 |
Series |
A possible proposal for intergating dmabuf to page pool
|
|
Commit Message
Yunsheng Lin
Nov. 13, 2023, 1 p.m. UTC
As we have ensured that the page and the offset to the page
for the skb frag is passed togetherly in one function call,
see [1], make it explicit that skb_frag_fill_page_desc()
expect a base page or head page for a compound page, so
that we can avoid the compound_head() in the net stack.
Log a warning if the caller passes a tail page of compoud
page and adjust 'page' to point to it's head page and
'offset' to point to start of it's head page. The warning
can be removed if we have ensured all the caller is passing
non tail page to skb_frag_fill_page_desc() in the future.
1. https://lore.kernel.org/all/20230511011213.59091-2-linyunsheng@huawei.com/
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
include/linux/skbuff.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 27998f73183e..3e2f806c8ed8 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2423,6 +2423,14 @@ static inline void skb_frag_fill_page_desc(skb_frag_t *frag, struct page *page, int off, int size) { + /* expect head page for compound page */ + if (WARN_ON_ONCE(PageTail(page))) { + struct page *head = compound_head(page); + + off += (page_to_pfn(page) - page_to_pfn(head)) * PAGE_SIZE; + page = head; + } + frag->bv_page = page; frag->bv_offset = off; skb_frag_size_set(frag, size);