Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3966274rwd; Sat, 17 Jun 2023 05:27:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Spv9YoBgYtWGFYbxKCdmoP30PmT0vQpMPx4nBxYvSVxDw8hmY+Eis1kDJoMtNQbSBq2j2 X-Received: by 2002:a05:6a20:548e:b0:11f:b885:e868 with SMTP id i14-20020a056a20548e00b0011fb885e868mr184361pzk.61.1687004833002; Sat, 17 Jun 2023 05:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687004832; cv=none; d=google.com; s=arc-20160816; b=Dl7BE68SA7YafXJ1QHe2kQaIUPSHRp2kC754DIlOx7XN/OTusCnFkDWpVQI4+jw2t5 vbuy86wAgcTwsJUTZJFAQ8UnLNozY7bcxti9WDS6blLE2qQ+nvmwCrmL22hvq9OwJ/2P WlXWXJDRht3tF0V9Q4GotRmgV50lHlTN9bFPxImysRwb5rdzhCxnKt5ak9RZGg6U9D62 +IfVK8t9HvstaxHyxYLnpbcQf3Kr70FL1h7TKca/IEscDgJPp6qJ+L5ft1LZTWz77Kw2 zBpoQ07y+eJ3MoDJG8LBn133kkISc1dDa+x9TWOzboUw59e0sM7tswza/hd/D04IP8df pu3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CX0szcw738ZS8htZ0RxEmjBFgUMhbKSUPMuc1XxmplE=; b=qnnTHwWq+kDO+PHm9VlAlk+iAInGOCWU8snuJEObrXJfuXp3NxruQu5DNUSd9NZ+B+ oUiY5aQu9Kl91918DNgq7mkzH7+45xdCrC0GFwkaFtlCjCralQjDCko2+VQZLlVxUP8T rgKzerOWfv2MKYHkMYue6JAJTJoIo/2yIGvhHuX3gXtGboP0g4Y0kWQXO0FoERdhXH2z XWQu7wtGWqku3oulTbqCxZDJQGjX5w9nVEJYLZewsHu3+GcQovN6uHsBETJVGs+fIDbG cJThUdmyjRBjWfHR6YG3C4oklHxPf8Mcagv8eCohMDY+OeOTrEQxv8cSnyT1yEK5FKSv Zf1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xbbpn9uQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17-20020a63c151000000b00545874b24cesi4748333pgi.491.2023.06.17.05.27.01; Sat, 17 Jun 2023 05:27:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xbbpn9uQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235825AbjFQMN6 (ORCPT + 99 others); Sat, 17 Jun 2023 08:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233940AbjFQMN4 (ORCPT ); Sat, 17 Jun 2023 08:13:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 112B42685 for ; Sat, 17 Jun 2023 05:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687003960; 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=Xbbpn9uQyIHRXfSwhuSl3nPjKtrOppznvd17XOhTPGWwOrLGxREISPBbKgFswM8ePu6/kZ XsJJuqMLcu8sHdm6Er6aTAtHU7LZZ2FDahpdjdCvwPeuZ1IQxMg9GHp6VbneEmzyBxD1IC nMzBTDJ7HiZKrz/k713nw3dl73AP6q0= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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);