From patchwork Wed Mar 29 14:13:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13192524 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 EB3E8C6FD18 for ; Wed, 29 Mar 2023 14:14:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6354F6B008A; Wed, 29 Mar 2023 10:14:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BFE16B008C; Wed, 29 Mar 2023 10:14:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 410806B0092; Wed, 29 Mar 2023 10:14:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 311D86B008A for ; Wed, 29 Mar 2023 10:14:48 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D6F9C120647 for ; Wed, 29 Mar 2023 14:14:47 +0000 (UTC) X-FDA: 80622131814.10.6810DCB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 221E3180026 for ; Wed, 29 Mar 2023 14:14:45 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YD7fLFro; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1680099286; 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=Bb5tuF13A7AUAmGHrtoNc4Ue+Am7P92yBHtRqoRTTps=; b=DKPtMGxKiblqjqOe+yueMQ4iPRu4InIiHUiNvNjUbxXwSEj94XN152sT1acaVT/Lo+7+6A X9Ha6v7ZGDo4HkC3LiihjJvvkxE7i78O9q80+48cuL09Ox16SxIDKq3jzsGSpuq3xoUgPy KybBBLiSxLQJORpd/FeaAoWrrUXTZKQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YD7fLFro; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.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=1680099286; a=rsa-sha256; cv=none; b=dJ4zigZJf3XM32b7EwaixVFkZqb6DIF5CIj0C9ujYlLFNSyC94hRGPgfhE5EVkY0SDKr/l vyz2zGMPWa/YTA9htHNjs3lbJewvUBDJefsRSoXqPF+UKD7KsaROTEnRgFiRDtiGi6JuY5 wUoTHw7Y1jVphLIIROX7G9Lf4e+boMI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680099285; 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=Bb5tuF13A7AUAmGHrtoNc4Ue+Am7P92yBHtRqoRTTps=; b=YD7fLFroNyFqVpPQpV9bhU7cXz0UKPNui4ki5fRd6/AUX2iMP1NBRnkKUfPt+Zp6XGnudb +MxRzazGIZ1pF04wYtXwSTFFziR66D59/Ez41SVjJUs+aahmevPiu7+yXGymy9Ot2xLzHM 2eb7fOp8IUU9vXqkvBkUsrOmhfPUdX4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-1vALR20tPYeGhBQuRt7gLg-1; Wed, 29 Mar 2023 10:14:42 -0400 X-MC-Unique: 1vALR20tPYeGhBQuRt7gLg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D8F81C0758E; Wed, 29 Mar 2023 14:14:41 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59D114020C82; Wed, 29 Mar 2023 14:14:39 +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: [RFC PATCH v2 15/48] tcp: Fold do_tcp_sendpages() into tcp_sendpage_locked() Date: Wed, 29 Mar 2023 15:13:21 +0100 Message-Id: <20230329141354.516864-16-dhowells@redhat.com> In-Reply-To: <20230329141354.516864-1-dhowells@redhat.com> References: <20230329141354.516864-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 221E3180026 X-Rspam-User: X-Stat-Signature: 5axtoqktpa5symyxt55us3kr3nwrhz5f X-HE-Tag: 1680099285-190796 X-HE-Meta: U2FsdG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nIAtXtFIZx0o3Xxgp04/Hk0t+DZbsWxN5UyDZvpcCaYz3Ox0WC7RPLBX0WaczaHDsCVm9lENnqUv+sKp00IPUp6W24ZrnwT0RVPeBIb4nPxfrHUeRHfJSYSWh9oQgtPDiu3QhQBfFxj117GC1iXgtO7jOPtSVVNebeWMSAyKGnlGi/8d+QhtzshjlxhgyqEjmLiLFgxFkllmdjFh30klMwoYgAvmCTkhgk163GpmVqMMyR8Tk4B39R2fgkI07uZoDKZEQUogffGZUWwesEgOjhyzfN9/3N1thTQLSbPZzU9V+hTKdgNyL5S9wHE5byN3FEty2YaXs7AZMKRUJLK4/DoJoD0il861L2JCfdXI9seGOgr 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 | 26 ++++++++------------------ 2 files changed, 8 insertions(+), 20 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 a1c5a6d9419c..a8f8ccaed10e 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -971,14 +971,16 @@ 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_kflags = MSG_SPLICE_PAGES, - }; + 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); @@ -988,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,