Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7957272rwd; Tue, 20 Jun 2023 08:20:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yHUM3XASHA1cRZ7ldBaeglos0OwV3cLd+XzcOrFvATurcyVEUi3R0ArVGOkTkMDd+zSwW X-Received: by 2002:a17:903:2444:b0:1b1:d8ce:73cb with SMTP id l4-20020a170903244400b001b1d8ce73cbmr4137189pls.59.1687274426666; Tue, 20 Jun 2023 08:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687274426; cv=none; d=google.com; s=arc-20160816; b=bDjK/j8++QeqXCkRW2/7UV63WvzrQxEnRfa3aujc+OkZakAKZwszKn0rBj3rpLFZKd xDcfTJJqQH5mWqp360zVZEXAcgitw5RiEvU7l6qanZ9WLd4AitpuvcGuRZCiRjfNWoMY xESYi3rcJpjRqBFfutwHUpZHFRg02YqMluJAypJvG0bzkNgik7fFY9+v7gpLI/GB2FSu Mr+u7f1chkUvhfSHgAe0GzbhvJ7p/zMoZD6qxFeG/afzkzvzhZ5NLeJSxKe8qa/zhWP0 h65WAGIOAfGMBJ+GWpbEO1sDi6PAprcG4IFYuEAhKL/w8tqQUMV2lzvY9+HnIa/27BNM sNog== 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=eBroZreMXMPUWA4GThA0pK8waDWAE1gE40DYsY4ySqZTwuZNbtNgRpqRFCUpl11kzu Xd+PwFyMVguBMkE41+armuzSoC6JI4yagTFM1MgBNApzLdt09iC17E4f9ZgwXHk1u7DD JLMdao5IeXvo3RognnBQXLD6dQDHGP3lXkUQKdbd6gc9Asx3glsdb57tPRVnbsds8ySY GTfmsw2c7pIEDOhGtxaG6FQA4uuWNxTEI/WunyiSDpzxuFgHnD1yqjvAa0CBExaEubjo k4SRHSlZhd7dhM4BvPd1JYvnM3sm8ScuavwFnQ2Zw+n3LhbvhwfvNK5h2rIFKjLfkJij EUyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a1k7jxLA; 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 ik3-20020a170902ab0300b001b3bbac961bsi2018514plb.38.2023.06.20.08.20.10; Tue, 20 Jun 2023 08:20:26 -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=a1k7jxLA; 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 S232936AbjFTO6F (ORCPT + 99 others); Tue, 20 Jun 2023 10:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbjFTO6B (ORCPT ); Tue, 20 Jun 2023 10:58:01 -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 5FD1719A8 for ; Tue, 20 Jun 2023 07:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687273012; 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=a1k7jxLAseAsNhZgzT9Uz2VAR9v/cfZVytBwbsHnNpJfCP5B7OVptpy5WBzKyaVh7/iAQe 8cnUNMkNT125J8wyzkmkNcH+QFkIJgDdI7qJeevsWcaGbZ/cAVXy42SsDOu9vkG2BIhhmp 43R/+yREKB+XBcXHg1tcmaXMlbOKEtA= 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-398-CpGHSxxIP-O4lq_Pb2IfNQ-1; Tue, 20 Jun 2023 10:56:37 -0400 X-MC-Unique: CpGHSxxIP-O4lq_Pb2IfNQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD2BE8A51E9; Tue, 20 Jun 2023 14:54:22 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B0949E9C; Tue, 20 Jun 2023 14:54:20 +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 v3 09/18] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Tue, 20 Jun 2023 15:53:28 +0100 Message-ID: <20230620145338.1300897-10-dhowells@redhat.com> In-Reply-To: <20230620145338.1300897-1-dhowells@redhat.com> References: <20230620145338.1300897-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=unavailable 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);