From patchwork Fri Jun 23 11:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13290405 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 A31F0EB64D7 for ; Fri, 23 Jun 2023 11:44:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A3248D0008; Fri, 23 Jun 2023 07:44:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 252F78D0001; Fri, 23 Jun 2023 07:44:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11B908D0008; Fri, 23 Jun 2023 07:44:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EFDCE8D0001 for ; Fri, 23 Jun 2023 07:44:53 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id ABC68160E83 for ; Fri, 23 Jun 2023 11:44:53 +0000 (UTC) X-FDA: 80933830866.24.5FC07FE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id E61A2100013 for ; Fri, 23 Jun 2023 11:44:51 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MGlqHsmd; spf=pass (imf14.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=1687520692; a=rsa-sha256; cv=none; b=BFqgtMsYMQCyJVNbajGhpEE6dVM9kgIaIVGLyV2PtFU5inRle9iXBWlQXgjDhYSPFzoX+Q xH3/T2klP1/iSTHC8JQ73LJcN65oT8m8jiBvC9dl1mWwQHqF1gKnK4X0SIQI757iYhkcWz B/XVSjUVfO53N80NJ7Giqn1DQTYSuOs= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MGlqHsmd; spf=pass (imf14.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=1687520692; 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=CX0szcw738ZS8htZ0RxEmjBFgUMhbKSUPMuc1XxmplE=; b=lP2ytQPqlmthdGMuFdu6yzzjuIVDtU5RCogh+NZ/aVbf4UHgefBNuFwx9kgZUq60d180i7 WJalU8zBG04AMjJLzyh+T4UMsQ3KfDX57uGI/V2j1l4W63MmMkO2L9ekg3og7tdkmeaWRk HryDbX285R33T181PIYrMIHkqIdus/w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687520691; 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=CX0szcw738ZS8htZ0RxEmjBFgUMhbKSUPMuc1XxmplE=; b=MGlqHsmdkpPxZ/l0FYZFAqoXs4lsOJ44dJ+K9NWh6CQJLUi/ToelewQ3Vqd/lGQMjnNcKJ 33sqJWbvfgqw03pY91XBdQoqjWzOaiTISFM9CRGxnkPNUFPu7blA0nfLFSUPlHu1D6OTgs ggxsibD9DvFfEhcb50t8S15dhSMBynA= 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-610-pOqU4RdaNZuHTBXvo8Lefw-1; Fri, 23 Jun 2023 07:44:45 -0400 X-MC-Unique: pOqU4RdaNZuHTBXvo8Lefw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5ADC28EC10F; Fri, 23 Jun 2023 11:44:44 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04E2C1121314; Fri, 23 Jun 2023 11:44:42 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Alexander Duyck , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christine Caulfield , David Teigland , cluster-devel@redhat.com Subject: [PATCH net-next v4 06/15] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Fri, 23 Jun 2023 12:44:16 +0100 Message-ID: <20230623114425.2150536-7-dhowells@redhat.com> In-Reply-To: <20230623114425.2150536-1-dhowells@redhat.com> References: <20230623114425.2150536-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E61A2100013 X-Stat-Signature: rge7pkgja9n7q144nnh1wsix5s7gh3fc X-Rspam-User: X-HE-Tag: 1687520691-732872 X-HE-Meta: U2FsdGVkX18KULcX8C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OJJmRY5M7W4u/0zxCqCyX88tCGVsK8ktNxAVzljzI+lyrfQ4JKg+esmcAny/YGVO3tcXIcP2TyPEt7KHSioeMh4Wvy7qd+F/aOCMhylDDEWcDTQI7Yt1Y4yiQxo7P9kQ0ljr8jfE/XpJrIkTbFEVvtQigaz3/M34nXGDelo0TxTrcAe7LR273NOy+OQdO3c6pvEmqpLhOoowXkzqJ7dVKXY52+uWCAcRXJ3fosnPTmTAg7HQQJVbJHOY2h5EcTSMxDVi8AneGRe4iMMXl6aLNZNVRL/UmHUebST5j9gIKWb6acNSFNk3fC1NyfQtLfZsCao/DjwLEPr8amyhXrSNTCHMpgjih8jHIR8sNj453JIDzVhWA4HnGVjP0gAiVLFMyubMLnUYS+v4MhnNJnYgqt3L2RUpfQ== 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 3d3802c47b8b..5c12d8cdfc16 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1395,8 +1395,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); @@ -1412,8 +1415,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);