From patchwork Fri Mar 31 16:09:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13196208 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 8CBB5C761AF for ; Fri, 31 Mar 2023 16:11:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BBEE6B009E; Fri, 31 Mar 2023 12:11:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 243736B00B4; Fri, 31 Mar 2023 12:11:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E4F76B00B5; Fri, 31 Mar 2023 12:11:39 -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 E6F546B009E for ; Fri, 31 Mar 2023 12:11:38 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2E263120D9E for ; Fri, 31 Mar 2023 16:11:38 +0000 (UTC) X-FDA: 80629683876.11.8266B94 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 657DB4001C for ; Fri, 31 Mar 2023 16:11:36 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XQ7Xl11J; 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=1680279096; 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=LkhnTzXU1X4znEA7DVY9E02LvPRWVvY4w7DVJkAd+bnkN6wx3578hixSeg4qN4wvF7BlZM a7sPX9osyjvFtIc1/G0MBKIgyYa3tnI2ymi2+X0WiSmwMHtew8maTw7fBpYA5dEjGQOm5N F7HDhlonZG0d0i3sRbqTulnVGRjJhoY= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XQ7Xl11J; 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=1680279096; a=rsa-sha256; cv=none; b=wcaMXqL2JVgtcmF1vSf4ISifPkYYHXixtxvauttYvT06sczF3F8mZ7Q7RV8Hosc9rFzkTf VXPQx/Dcn0qDVTb8B9iSiRuX56sBqOj+wJYi5dtbn1FtBpO9THNCcyJVyYKn9WTRguJuHf WbqXDfi/AlJrT61NBH4jPtkwKiAGkxY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680279095; 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=XQ7Xl11JcU0g0QoyHLqRjt1H/ub1Cf5WUiTkse8UlTEcpT1CQIgceHxljMidQ2N6VzMet0 NqAgMlT8Lb0P43qvPb/4zgn/K1g6nfNrvvCax/d86CHZwFB85Y3/RDp6YrhpgB4Vf3nDVV ZoG4xjpV4r0QwovLZ5WaLe8TzkVSGDg= 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-611-KDykX2VqNS617UfimOZiaQ-1; Fri, 31 Mar 2023 12:11:32 -0400 X-MC-Unique: KDykX2VqNS617UfimOZiaQ-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 6DE3E29ABA19; Fri, 31 Mar 2023 16:11:31 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AF201121314; Fri, 31 Mar 2023 16:11:29 +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: [PATCH v3 47/55] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Fri, 31 Mar 2023 17:09:06 +0100 Message-Id: <20230331160914.1608208-48-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.3 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 657DB4001C X-Stat-Signature: 8aky1qmnknykpyojbwd5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efY+4feqlxTaGc3EZ07A9ka0aWWlT09Esx82yGzXCIKfB/adb6M9TsjZdt/blu1FHiZg7c0Njxc9geKMnlBqaSTZzZpCfZIF4j21gsTRqrm76iSe/nWQhwy4TMKTMTWcIoZGE8ZQl5z1kaY+iMKPdjo3GsTmCUpLo3Kr1zUi3Z5oGrF1Rm4SSphsw6f91Aw+Ec1cnafT5VpWh80rngd5XLALoIyOxFx2yNig7NoVjrKJeHYK4wBL830lp8Sr/HMUxntUa57f1D5dRsBJJ3w48miJVxLMbAMvck5d+kyhyh49tbsGKgARmUMXcx8gMva/fW9oq9hPf6iVDh4rcfQU4XC2yP845rW88p6RHUkQbsZTINzgxDEYlmngQs7mk7hdN3ezl/o9mck3WQ== 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);