From patchwork Fri Jun 23 22:55:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13291444 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 8AF64EB64D7 for ; Fri, 23 Jun 2023 22:55:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5004F8D0007; Fri, 23 Jun 2023 18:55:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48A4B8D0001; Fri, 23 Jun 2023 18:55:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 242E28D0008; Fri, 23 Jun 2023 18:55: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 EC97C8D0001 for ; Fri, 23 Jun 2023 18:55:38 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C33F91A033D for ; Fri, 23 Jun 2023 22:55:38 +0000 (UTC) X-FDA: 80935521156.27.39592CA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf10.hostedemail.com (Postfix) with ESMTP id 08705C0009 for ; Fri, 23 Jun 2023 22:55:36 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WYvfvrFD; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf10.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=1687560937; 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=k7nBxsaJtHaKC5BVVURWWQ5qm2UP18F6ia6nUgUEAklNnOysrETBVR8TNjqbXIrYyEpQWO G16P9uDSkSglKgLDxnPyvrr50FaGQLj9wzUXhgOyzp4KSTlbA05xMtisOWszRUZYplCG3v 1fKUFCAx8vhVpEZOwOGTZ4sl6zcDiH0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WYvfvrFD; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf10.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=1687560937; a=rsa-sha256; cv=none; b=Z7wyL4PdmjpxmZNbwD74zvUt8eHqOTBnFlqgQk9l5YpiPgTyex6fFji00JXIyIRoJ4GZXs niXZuP0bxre97PF2AQW/mGFW+YTytoNMFRDo0KzTlXI8SeJQazLhBEn8nS/y4/HYVupUOw u41Sq7jKlG+H3ywdj51bozlqE2i+VBU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687560936; 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=WYvfvrFD6BuEHOkPWPkfXbLalZuvkoIYvY1T0AIhLHql2TxB+7Ujbj5pzqJIzeEhtPyn+L 2uUpZetZZqauti21OB+XNHM2GX20OyR5f0uzrEhDezC2s0MxfYM2Sg2Yd2ZC4M0yEKVgHF cgLGBgznn6hl5Hq8iGbtlJ7PRfVNjzE= 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-380-3sv4_t5gNYKj7bwjVePyIQ-1; Fri, 23 Jun 2023 18:55:34 -0400 X-MC-Unique: 3sv4_t5gNYKj7bwjVePyIQ-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 41DED380451C; Fri, 23 Jun 2023 22:55:34 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C49B40C2063; Fri, 23 Jun 2023 22:55: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 v5 06/16] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Fri, 23 Jun 2023 23:55:03 +0100 Message-ID: <20230623225513.2732256-7-dhowells@redhat.com> In-Reply-To: <20230623225513.2732256-1-dhowells@redhat.com> References: <20230623225513.2732256-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Queue-Id: 08705C0009 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: q9gecifjq5tfyx9kfigawa7n68uxcipx X-HE-Tag: 1687560936-620621 X-HE-Meta: U2FsdGVkX184J7a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wKBeStoeNFuXvJ8EFEG1nP9ACoOCOsxtD78JbFJkUzEvtXqJ5iCG6qEfnW52faSp/v5xgF4ZBs7/SqHCvIPW6YG4g4jm5wSFHHerwsZ4S2r7meMi2aeOalyFghxMs2sR1o/Q2l+ObyiEBcPM+0vvRiDED+udb7h520UT5cwr4m5Q1KYmlrwk7jEI6j86DHB+BkkrbX8lugs78atKKLk3B5Vgc8y1c054zpN4CXvR3P77tnvWHRZx4/qB1Rc/LM4sPRacJ1NOv9LUwp87aQpJUWQjklrwASQafqxHtaMaE2SRacvDxNBMGj2cczxauQNo1L0hcJuvv5f0PilTOAzhWnTeJSTK5oMBBE9Aqu9xV0D2zo69LebQkTBU94nJT3hG7bD//6ya5rtTW0sJbw== 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);