From patchwork Fri Mar 31 16:08:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13196176 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 27073C761AF for ; Fri, 31 Mar 2023 16:10:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79DF46B008A; Fri, 31 Mar 2023 12:10:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74D256B008C; Fri, 31 Mar 2023 12:10:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED9C6B0092; Fri, 31 Mar 2023 12:10:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4D6B06B008A for ; Fri, 31 Mar 2023 12:10:11 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 205EE160487 for ; Fri, 31 Mar 2023 16:10:11 +0000 (UTC) X-FDA: 80629680222.21.64B09AF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 4851D40010 for ; Fri, 31 Mar 2023 16:10:09 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RTQfrxu3; spf=pass (imf12.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=1680279009; a=rsa-sha256; cv=none; b=5WHySariQbTAlc1ckEhig6L77WMLQW90PTv7cBQkCHfPJFkDC0XkUI7zQRExGMaUvz352c OgI4x5Q23H+boecdcb4fZ1XvQzvJy/Q+X3u220D88iZBbbafBxGUnXnJzh/wBqr1yasAq4 ev3NvKWyTRc+hjQDy4q6FoImn02jChU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RTQfrxu3; spf=pass (imf12.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=1680279009; 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=s/WKKKfYkgZLf01K/tBKWgYukXTjbxBIh6Ytrwu4rIE=; b=aRUAeVNQraY17iqzq+Gk2vSXPhdEQihwQSN7w1wADQBlZAoAbcZOA4WGaO5VdQdT5pmMXB 068TjkPSVUroTvhVZJ1S5TywxSwaBTBvk/UuQtrHMSmfRajpp7Kqv02UNF5vVr57hH9NQm dWWCB00WaPCWD9Rb9NR9DiWviWTiilw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680279008; 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=s/WKKKfYkgZLf01K/tBKWgYukXTjbxBIh6Ytrwu4rIE=; b=RTQfrxu35RSMrhPeBnpkjhDYQ1cvjQmnAWei58jxpxyqJfGLBib8r6WAw4t63MpOz4/Hvo +57yQQxGAFD/0IVvG+ySa1AJ21izpqmRFwSNg0UarJ8lCKjNqB5zQFvkbscGn/nJPowADS 2vmM4CYkkISOx7LUF8zd1JMhj7SINjk= 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-637-LFWHst1IPamgtZLqqI4Kfw-1; Fri, 31 Mar 2023 12:10:02 -0400 X-MC-Unique: LFWHst1IPamgtZLqqI4Kfw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D7C2858297; Fri, 31 Mar 2023 16:10:01 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A3E1C15BA0; Fri, 31 Mar 2023 16:09:59 +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 , Chuck Lever III , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 14/55] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Fri, 31 Mar 2023 17:08:33 +0100 Message-Id: <20230331160914.1608208-15-dhowells@redhat.com> In-Reply-To: <20230331160914.1608208-1-dhowells@redhat.com> References: <20230331160914.1608208-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Rspam-User: X-Rspamd-Queue-Id: 4851D40010 X-Rspamd-Server: rspam01 X-Stat-Signature: orcbkeyuhmtzqq3hsrdchmizduybh4an X-HE-Tag: 1680279009-392693 X-HE-Meta: U2FsdGVkX1+am0e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1S5vue0LTIhFbPfMT9hu0VEEN7BKt/QykbQ6WuJZGKhv/Bgv+wbkmcnzFaN+NtbFaOv1cFsnjUg5qEkVGqNFJSXz5KAsjRGfqi0J2uDcznYiC5dnwjCdTOC+LHvec+EC1a0r5MOS8wk37WjTv00ilsS7aewUH1HZfVbI/TQemPziashU53fx/evfXyaLXuIhyFVrEEAsK50JXo3K5MfsVDlAsW4WMkDWNPR8exeDyRI3GDpspHwbSpVE/nXSZ1iS2xr/IfiV8jgwf836CQ29iRDbyNHITQxIQt7ZII9cz4KLqL2xorTx4qIz7RFO5P3LVWQsx6LUeeJu6VX 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 edcf3a60c1b0..a8f8ccaed10e 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -971,12 +971,17 @@ 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); @@ -985,18 +990,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,