From patchwork Sat Jun 17 12:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13283549 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 42B33EB64DA for ; Sat, 17 Jun 2023 12:12:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5C096B0083; Sat, 17 Jun 2023 08:12:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C0ADA6B0085; Sat, 17 Jun 2023 08:12:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A85888E0001; Sat, 17 Jun 2023 08:12:42 -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 910666B0083 for ; Sat, 17 Jun 2023 08:12:42 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6448A1A01B8 for ; Sat, 17 Jun 2023 12:12:42 +0000 (UTC) X-FDA: 80912128164.10.9452039 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 09AC71C0009 for ; Sat, 17 Jun 2023 12:12:39 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G4Lymllm; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687003960; 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=igqFSkRz2ykr8RgMR41qfFgwu8Mex44RzFnPwPhnB25sZZXm2dRI5BNLAmWHJfYsDOAIFv eF8Eura5OPMmotOlv22mOdT/dI5MC194QR8FGYath1htuw75QaXdaDx63wnJ2vsuNG2xS3 m7KtraStlUagRL9IQwj534szn2LwfVk= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G4Lymllm; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf20.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687003960; a=rsa-sha256; cv=none; b=WNy0qKCecZ3XZe7Tz020sKNfWRs4r5jZ3sQSS04Tybn2c9slBnoQ3XqZspuk3J2+9RaVoQ YKTfly/HWLb5i1H4c2HQWp8m8D/b7lBGoUTBiniaZfC5hRIPnbwCR+UmEOq4yA7xSmSTwb 3iT0HONRB4M1Svga4UpkgqSPBjaIMu4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687003959; 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=G4LymllmGQix3iv8pz6y3kQnYz3GgTBzpjYcta8M4NhdtI4CgF5uZ/zX49VycDl0gHWbEU hbBdqifXojtT1Oqg+6YDuUomKF0JnauhYHQrCr+YYhlQTz3OP9k2Z40Y8UIWz/wzEez0Ks IggnyYrPJljBabvya2GUUZjkBgVR19o= 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-198-ozIpHJTiMYSJ2JP6C3x6Cg-1; Sat, 17 Jun 2023 08:12:35 -0400 X-MC-Unique: ozIpHJTiMYSJ2JP6C3x6Cg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F71285A58C; Sat, 17 Jun 2023 12:12:35 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A69640C2077; Sat, 17 Jun 2023 12:12:32 +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 v2 09/17] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Sat, 17 Jun 2023 13:11:38 +0100 Message-ID: <20230617121146.716077-10-dhowells@redhat.com> In-Reply-To: <20230617121146.716077-1-dhowells@redhat.com> References: <20230617121146.716077-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 09AC71C0009 X-Stat-Signature: ez3pdzbssohwa8fajjiqt36w1b13derz X-Rspam-User: X-HE-Tag: 1687003959-121337 X-HE-Meta: U2FsdGVkX1/R97RdCh3rcUIHwxdbu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99G1UDG8bAH4+YEV2prXGCrVDuYfLnqitsHpWZr0koP8Wamzwo61bAR2sjUojq7z2tU+/NnCvSG6tmgCm+Xa/CoF1NFdHbEgkbKmHKe9B4Yvpivme6bIsnx4Ei/6rjGBIoC1VJ5oWCmGrfNuY4zkHpmGt/+Pz2QAwnrBjA1FZsqMMbRrNCWQBdLnyGJ/SksdlukzUBfflrmjjDhAclLwlfXOEFLow52Nd2kQjQELcgoFS5Hn9GKhi2rifFRihmB0a7n8+h8ssa7UDYwik2/JXDdjMmjd1kNBhMZHD+/1EfrUjoInnaHIEfycLzQshk6iHJj5wHFK91Vh5n0p2AJZmVRU4gqCmQGNVDl4h7mVe/hlArIzD8ere/c5poKRpft5TfGo4XFE6T3I12EEelnQ== 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);