Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2889517rwd; Fri, 16 Jun 2023 09:24:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6SBbamOOIGkhi8gm9/niU5Gkd3nVZBWF7qKpvRdswvPkYBtvSyOlDZHQyajbm6trlWRdO9 X-Received: by 2002:a05:6a20:429f:b0:101:4c8c:d1ee with SMTP id o31-20020a056a20429f00b001014c8cd1eemr2723863pzj.50.1686932666760; Fri, 16 Jun 2023 09:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686932666; cv=none; d=google.com; s=arc-20160816; b=Tpo+SqS8g4iPBlUU0oQscJIlfmoM9ld+wr7pQdzug/suLSpLMQcN2Gow9fhNyzE+wR 07HBboOv67vxHYzH1xT9eqIcciegB8JkGQsv1lLRr6YfRRT6Ub4215/wxugupmOWpS/N 0RhqDWb4Nx1PMm0Bd71cDXbkrR0c/gy8GcpsZ+g4XO+G3D0/mwsSS8uA6mWSml+1k6Qe 33kXQ0LKltHUrpJASQ4KBmBjDYEieuHDEeZ0OPjsuoQ3vMedTfA9GGftkFNHf1KPyn31 stm8cB04UmGJfGjepyOm9/p3fDMhLLKKefXtdlhbHS0nl9U7V6PIzFMycxaRurnCCpCM yv4w== 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=leD/G2Q0yQzFHs6l5BlO5P1et7dFr5tu/kX5ujItBxlJEKRA1thzX7KhAnc/iXQ5e9 HR/Ixnj4XdXYIp3GJEWN8iyiJXDzOSCr9M4PbUAGLZgT5PlSqx1W45KZg2dj38QbKlV2 T2nQyp4LhJrv/SK7IWrjxQd89DuyELtwD05dSWgMrYexia8Z4JHZ/I/QkG1nWYo7AAtn HyJvhWNb4XWlCmLm+axXx+thxVLspVMqJtipnU32I5nmgaj9w/4zt8/DLAPYFlhqR3Zs 4cOtpMXZAuFSzk9BQQ1DMIPGBisYooM8iMc2VVGwchLdYT4cPFeF3yEKJB/mGTBHlMKC NneA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VIwI7kLq; 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 z26-20020a637e1a000000b0053ff2caa766si4909424pgc.550.2023.06.16.09.24.14; Fri, 16 Jun 2023 09:24: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=VIwI7kLq; 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 S232984AbjFPQQE (ORCPT + 99 others); Fri, 16 Jun 2023 12:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344017AbjFPQOa (ORCPT ); Fri, 16 Jun 2023 12:14:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E55E35B5 for ; Fri, 16 Jun 2023 09:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686932018; 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=VIwI7kLq82ozjeW6w/+MqQyUWqxnRNrNWa17peKQM2wfErNIqqhuN/an65NFRhWYovIKH1 /JENrJmHGWyPLsjE7O5R8GxXH57CGU1EoW9nl3Z7xD9OUCqY0U8V1dBzkxF7lsb8UIhBka pScrTtSfX5EoRgi5w9XdrO3PUxlII44= 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-177-8EMyMs2DPWaeQu2vizf65w-1; Fri, 16 Jun 2023 12:13:37 -0400 X-MC-Unique: 8EMyMs2DPWaeQu2vizf65w-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 8823129AB3E3; Fri, 16 Jun 2023 16:13:36 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76298422B0; Fri, 16 Jun 2023 16:13:33 +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 09/17] dlm: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage Date: Fri, 16 Jun 2023 17:12:52 +0100 Message-ID: <20230616161301.622169-10-dhowells@redhat.com> In-Reply-To: <20230616161301.622169-1-dhowells@redhat.com> References: <20230616161301.622169-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, 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);