From patchwork Thu Mar 16 15:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13177809 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 6C3E1C7618D for ; Thu, 16 Mar 2023 15:26:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD4B994000C; Thu, 16 Mar 2023 11:26:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3556940007; Thu, 16 Mar 2023 11:26:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAEC194000C; Thu, 16 Mar 2023 11:26:55 -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 AC5DB940007 for ; Thu, 16 Mar 2023 11:26:55 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6F5201C65F5 for ; Thu, 16 Mar 2023 15:26:55 +0000 (UTC) X-FDA: 80575139190.28.0695C01 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 82375A000B for ; Thu, 16 Mar 2023 15:26:53 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SoPbCgCQ; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678980413; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QhIOxGsJKwUbwgq8gdEm1+0LSvzfey76e2D0sxuOMBQ=; b=AF6lN4pEAbKrBY/4jdG0a5ae1Klik8vbjAsCBKJCrZ8qDRgYoZIvOOIuO/Q6zXYHipskPm V4IqoMes8TFFfxtkWMZporWQONQHlyHFe3rIf4wHevIcXqoLnaBjGCUO6odc0CeYNeuCQX rptudEdNCVnj2CyoTvKS6XhJTWv+iKA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SoPbCgCQ; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678980413; a=rsa-sha256; cv=none; b=N9BVbvuOBgO2GbPARnMAYFgGNNWzvpeYVrn+D3QV00PWvUX2l0jfR1EuJEsy30zGV2Pg6G u/I8KpPHms/XhAycXAZvTac/YTptCBlyOEP/DCvXz7AyJTPpBqQ9BWoiA230w2GPv+rasN KVW6SfzY36zbYGebB3H/N0n9U0mcvLk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678980412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QhIOxGsJKwUbwgq8gdEm1+0LSvzfey76e2D0sxuOMBQ=; b=SoPbCgCQJ3oGC1CEGNZgd7g5eCleJvkgjyX2SKE6xidH21Bpmhlhkwb5ZNJv2ZPk+DgQvc iEhk9j+s2WIDwOjj/e/nMhYE6CUH6fNC6Gi7Hm/EKR8+kyWNO0GQJRjO9WpinEVzeWpZmi PI21bLB5j7sFZwX2/R2pMnPBkpSsw+M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-393-LNOwTe9INm-jM2IkB3Pl_A-1; Thu, 16 Mar 2023 11:26:47 -0400 X-MC-Unique: LNOwTe9INm-jM2IkB3Pl_A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A44A8811E7D; Thu, 16 Mar 2023 15:26:46 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA02540D1C7; Thu, 16 Mar 2023 15:26:44 +0000 (UTC) From: David Howells To: Matthew Wilcox , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: David Howells , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 09/28] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Thu, 16 Mar 2023 15:25:59 +0000 Message-Id: <20230316152618.711970-10-dhowells@redhat.com> In-Reply-To: <20230316152618.711970-1-dhowells@redhat.com> References: <20230316152618.711970-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspamd-Queue-Id: 82375A000B X-Stat-Signature: q3t9xtngsitei663tfa36tjsimjbbcmq X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1678980413-984186 X-HE-Meta: U2FsdGVkX18fui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1I1zVcLA8X+M/OzUWnyLSySuZ2AIKUB76VN2s+9OqsQzyL80HKmdNy7ik7eojjXqq2mgK1iRFysZyqS5VyAixSIsPK7bs2/LtILVahFKIiPMtfQZ+eMLmBpc9Zzo/IULu5VNHynjLq0u66DhHAYguCdxJAH8EDMC5qKqgYGYMpy+b3uzk2cv7kkG9gr3WE82JhgQk6L1gelzoHYC8GIS4U/9U2i4HyM62tgheWIpnTSKBy/2C0Bf+S1/yx6wJm+E44HqniBAF/QXyG5Jx+zSZK5fqqD9dK/X9miVB++hVvgx48PfAOJvTdEXhAZFkKrJ1/80/mVs4F5IfIn7EIjb1eGRrSOvg4YLCv 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: Fold do_tcp_sendpages() into its last remaining caller, tcp_sendpage_locked(). Signed-off-by: David Howells cc: Eric Dumazet cc: "David S. Miller" cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: netdev@vger.kernel.org --- include/net/tcp.h | 2 -- net/ipv4/tcp.c | 21 +++++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index db9f828e9d1e..844bc8e6a714 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -333,8 +333,6 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, int flags); int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, size_t size, int flags); -ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, - size_t size, int flags); int tcp_send_mss(struct sock *sk, int *size_goal, int flags); void tcp_push(struct sock *sk, int flags, int mss_now, int nonagle, int size_goal); diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 7c3acc5673e9..f1454e4497df 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -971,14 +971,19 @@ static int tcp_wmem_schedule(struct sock *sk, int copy) return min(copy, sk->sk_forward_alloc); } -ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, - size_t size, int flags) +int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, + size_t size, int flags) { struct bio_vec bvec; struct msghdr msg = { .msg_flags = flags | MSG_SPLICE_PAGES, }; + if (!(sk->sk_route_caps & NETIF_F_SG)) + return sock_no_sendpage_locked(sk, page, offset, size, flags); + + tcp_rate_check_app_limited(sk); /* is sending application-limited? */ + bvec_set_page(&bvec, page, size, offset); iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, size); @@ -987,18 +992,6 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, return tcp_sendmsg_locked(sk, &msg, size); } -EXPORT_SYMBOL_GPL(do_tcp_sendpages); - -int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, - size_t size, int flags) -{ - if (!(sk->sk_route_caps & NETIF_F_SG)) - return sock_no_sendpage_locked(sk, page, offset, size, flags); - - tcp_rate_check_app_limited(sk); /* is sending application-limited? */ - - return do_tcp_sendpages(sk, page, offset, size, flags); -} EXPORT_SYMBOL_GPL(tcp_sendpage_locked); int tcp_sendpage(struct sock *sk, struct page *page, int offset,