Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp439008lqh; Thu, 28 Mar 2024 06:43:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWErS7Yr5qlpbrIOrYn+7ucrAQ3bM4Z37DL8G4z4JVgTiVR/XrZtrFBlGbB6P/p9zYl1lGCMriB6fKckRFARAzf4fofZvO5mn81NkB/LA== X-Google-Smtp-Source: AGHT+IG3CbD8XtxZRmTUBnq1p9AplX72bALYnpsutaN90sEtHX6dN9Enmk6nrPyDE60tWsfRPq08 X-Received: by 2002:ac8:580b:0:b0:431:3ec5:b221 with SMTP id g11-20020ac8580b000000b004313ec5b221mr3710714qtg.52.1711633392854; Thu, 28 Mar 2024 06:43:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711633392; cv=pass; d=google.com; s=arc-20160816; b=aDIXs2XP0kocGZl35DRdzs2V47KDhp3kdkBVU8d0kd1f7x+nwbOD++dAwHKjHWqmFI 4l5ryKsv/rYUPhjOK+nYMTumuRbQgza3Rkb0+OjuDaNkzstACSy4kBctfwyJQnYItWIO lO2eBWXGxwWhUBUQpDV02dUkeLSTPiCLm8h83R62Vc3wseQqf62P6E+x8979ZpbEaFXN NTKD+hqSifB2mOkAMtqtbSJMAmLW3xIGXbd6ehZ7FLkZjnO9dfs39e2UfF/S3e0lJfWK XCQr/VjfWReoevTUGO36RLEAfEHE96aD21VaKPpU1fIjBlSagFpk50CGvwexq+eHWHiy zUag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=0qrQu5/NQ8TIwgSW+mrLCUJPTDX1DThDwV9f7bmO0IA=; fh=D6xVSegNul4KrUJ9ERmiGKlse4yUgZ/4HEoMM009vXk=; b=OxYhcShcgxKE44G6d5tIUMWHCvaELyhaz8twWXS2vBzP6qj+aKaezdBMpmJR0FNtrN 9Nue1vcWjrPPBy/fPv1V8qq7M2L/o6drzVsSWbYqvoA3Ee9vz42ipk00wDg8SLebXLO9 uyNes3JdF6HVgXz5yx79wCKyRrHYjEe++QAAYWwyBeMjiQ8zsrgKs/2cyHlggMxx1fdx yESAN7Cx/xD9miPSRspZCrSvrgOzNTd4EiOVQECVCdYtsdkTdqMZMc3byteI2BfHiVBE NpQJh8i8SpkjI3nZtSf74vmYm43LWpuQ9kYnQ4jeeFgBUPx4gOiBkDbxpDDdZ5WMa5NM ZJ+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-122977-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d21-20020ac85ad5000000b004313ac9c0c0si1472222qtd.576.2024.03.28.06.43.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 06:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122977-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-122977-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 91BF81C2822C for ; Thu, 28 Mar 2024 13:43:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C774012FB3E; Thu, 28 Mar 2024 13:41:03 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8089D81AAB; Thu, 28 Mar 2024 13:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711633263; cv=none; b=VA3/B9M7kprqeBRNHapyiaK72oq5vA/2w+IfPViLVZur2YCf4XNjLmX4QRrU8PPzUPGHU6Ri0WRGBxQTfXYp6W26dXLuUeMcqawXUmhSyWMxKAb+igkIcH1TDyNNye85/J+E6309s05JQA1dUtq9z6L0f4/Hc6g/jwcyJSVffr0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711633263; c=relaxed/simple; bh=+YJ5YJDIpQk7oAx/oDARWJ5TozchVIOjINAEsH4F3GE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=toL+PjiglsqG6YSKWe15wK5ab+jeRdVwcCzE7N8i1PiJpQL0x+4F0VkR7Q+QYAwCGqXlO/NYn/kNtD5AhklpNJBVFjqzDi0ZgoXXP0nOdzfvD84pBUIPal65DIsU7sDhIvcbOMR6481MBaTlzarbUo/drK4dHZy0z80Il1XJvZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4V54Ps4hZRz1xsXS; Thu, 28 Mar 2024 21:38:57 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id 576261A016C; Thu, 28 Mar 2024 21:40:59 +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_256_GCM_SHA384) id 15.1.2507.35; Thu, 28 Mar 2024 21:40:59 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Eric Dumazet Subject: [PATCH RFC 08/10] net: introduce the skb_copy_to_va_nocache() helper Date: Thu, 28 Mar 2024 21:38:37 +0800 Message-ID: <20240328133839.13620-9-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240328133839.13620-1-linyunsheng@huawei.com> References: <20240328133839.13620-1-linyunsheng@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500005.china.huawei.com (7.185.36.74) introduce the skb_copy_to_va_nocache() helper to avoid calling virt_to_page() and skb_copy_to_page_nocache(). Signed-off-by: Yunsheng Lin --- include/net/sock.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h index b5e00702acc1..20df93699b60 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2265,6 +2265,21 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *fro return 0; } +static inline int skb_copy_to_va_nocache(struct sock *sk, struct iov_iter *from, + struct sk_buff *skb, char *va, int copy) +{ + int err; + + err = skb_do_copy_data_nocache(sk, skb, from, va, copy, skb->len); + if (err) + return err; + + skb_len_add(skb, copy); + sk_wmem_queued_add(sk, copy); + sk_mem_charge(sk, copy); + return 0; +} + /** * sk_wmem_alloc_get - returns write allocations * @sk: socket -- 2.33.0