From patchwork Wed Mar 29 14:13:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13192550 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 79902C761AF for ; Wed, 29 Mar 2023 14:16:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 968BF280003; Wed, 29 Mar 2023 10:16:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 919AC280001; Wed, 29 Mar 2023 10:16:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76B20280003; Wed, 29 Mar 2023 10:16:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5738C280001 for ; Wed, 29 Mar 2023 10:16:04 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F35A4140D15 for ; Wed, 29 Mar 2023 14:16:03 +0000 (UTC) X-FDA: 80622135048.16.2EC0AD4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 1E3FE40028 for ; Wed, 29 Mar 2023 14:16:01 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EsEQu02c; spf=pass (imf27.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=1680099362; 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=6d/Oxl1Cdu8ybDL5tOgPD1gv3cW2fyMj4HBClKMadWo=; b=APGYS6jH/zNJeoeIRi+QIBxAGZhvHa3ZEWy9fmVJjhOUge+2mNViz3W671PklBxg9xCCB8 ht1QVSF3gNAXG06RtZl9oQKPGNoVjYxFhqPK+VNBv5YUKt8KONxU9ejvFo886aNL6BUGa6 VapoEFuUMIHgB+WUILleRn9vLjJp2Vk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EsEQu02c; spf=pass (imf27.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=1680099362; a=rsa-sha256; cv=none; b=sOMllwSHbO89KUbqQiv3i4z4eSSttGDdGpdqzmREZ3WI5xw/xGUGOAvVup2Y2PHPnW4nl4 QpzQKO/6PnVPrX6IEreY3AFxe+bxGIOPWZJxYxQC2ZhMzzALsmHUZeiAjo0xxgaLx70ait VFITwI0J2V9FoaKIuPwfF3HBTSnsKIg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680099361; 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=6d/Oxl1Cdu8ybDL5tOgPD1gv3cW2fyMj4HBClKMadWo=; b=EsEQu02cerYn/z1IvneKcuc61mHflIEjirnRZ1OnNPxy2hCNdiEx/tz6hfHE0de6PIe03z sHIEjuXgb25jXrOT+6a+4nZNvJYw57Osq34xoxUgqG/fZ+QcFdJDhlCkb3JmcYIU/5U+Pq w1TgJExeE1SpykWWmuEikvlocO0eVEI= 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-619-i1SRZaD-MumdNlQEtFGyZA-1; Wed, 29 Mar 2023 10:15:49 -0400 X-MC-Unique: i1SRZaD-MumdNlQEtFGyZA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D152F299E75D; Wed, 29 Mar 2023 14:15:46 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BAE12166B33; Wed, 29 Mar 2023 14:15: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 , Chuck Lever III , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christine Caulfield , David Teigland , cluster-devel@redhat.com Subject: [RFC PATCH v2 39/48] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Wed, 29 Mar 2023 15:13:45 +0100 Message-Id: <20230329141354.516864-40-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.6 X-Stat-Signature: ex5p87n561kmazay3ku8493d1x4k8g4a X-Rspam-User: X-Rspamd-Queue-Id: 1E3FE40028 X-Rspamd-Server: rspam06 X-HE-Tag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j+vjFUuumuqaAXLOcNsUyy0OGf5btwxYxOVZ5txv0NEM88u8SXLyigbPdcdUbxEQNUcVbsmIV6iMtt0QYBwIq2dU8OLvY7M/UWiibql+l2a9ZEPJZERrjczerR2pN7aA3jUXVwHMfpXsIJPiz8QvjtHzdal1KpTXi+c68jgyg0LI/6GiDLlXCgHAwkFNUYqxdWqo/VTlsRpv/hEICD6vVmlTyli4RPFBY6s6rFtVFnRNOZW+zgRJymhKQ5vvIc11jQ2l75ncA/9JffvlHyAuHSVR36LBgf5qkErm2eDhd4uv13DzXjGyxVcvyTW/YGnv09gzscHRFTvhtib2j116UqdmpgR4/kUMC+lhYIf9tZ4yF5QaF/tG 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: When transmitting data, call down a layer using a single sendmsg with MSG_SPLICE_PAGES to indicate that content should be spliced rather using sendpage. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. Signed-off-by: David Howells cc: Christine Caulfield cc: David Teigland cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Jens Axboe cc: Matthew Wilcox cc: cluster-devel@redhat.com cc: netdev@vger.kernel.org --- fs/dlm/lowcomms.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index a9b14f81d655..9c0c691b6106 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1394,8 +1394,11 @@ int dlm_lowcomms_resend_msg(struct dlm_msg *msg) /* Send a message */ static int send_to_sock(struct connection *con) { - const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL; struct writequeue_entry *e; + struct bio_vec bvec; + struct msghdr msg = { + .msg_flags = MSG_SPLICE_PAGES | MSG_DONTWAIT | MSG_NOSIGNAL, + }; int len, offset, ret; spin_lock_bh(&con->writequeue_lock); @@ -1411,8 +1414,9 @@ static int send_to_sock(struct connection *con) WARN_ON_ONCE(len == 0 && e->users == 0); spin_unlock_bh(&con->writequeue_lock); - ret = kernel_sendpage(con->sock, e->page, offset, len, - msg_flags); + bvec_set_page(&bvec, e->page, len, offset); + iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len); + ret = sock_sendmsg(con->sock, &msg); trace_dlm_send(con->nodeid, ret); if (ret == -EAGAIN || ret == 0) { lock_sock(con->sock->sk);