Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11634193rwd; Thu, 22 Jun 2023 16:34:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OrjJZUG7Z4MTOoJ+pmrqCFlTWPsGvRbZ9thCE91QJZEEMZJ5tGzH1LA53B0LCExtVfUHr X-Received: by 2002:a05:6808:150d:b0:39e:78fb:c432 with SMTP id u13-20020a056808150d00b0039e78fbc432mr19031960oiw.34.1687476889139; Thu, 22 Jun 2023 16:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687476889; cv=none; d=google.com; s=arc-20160816; b=VPXUf8Evlv83IQqUajKn0TCZKnSt+N/wdELwdj2RrIE/4ohO8tpw6flKTa+p70RZio yK5bSU6M+womWl8hfT6nwUpNqTgM4t1YcElAqugl6MeD/YXWubMHo1PLui/7tYS/2iIz feFPYNqsvSL80vHrkpQ13pSgJyAZqv9/tlZ2uJFaa8h4YdcrzMSmXwTdPrl8k6z9IkDm +SBH9YMGWgC9ex/0TpRWotX5SePbUWgSY1x8ymMBQ01Qx0Y+ukzvSJQo2N3nbBK4di4S VtsH2ZbuU70JUrMfrRC+TXro4O3ZjVoomvA3yTq3qv0ZOpwTAT1JhlMADqnvrDwf5qfq lj0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=CoZIUtTkYvBb1iCo4vdxE0rm6LAMYX4km4nzgk6efLk=; fh=hDqhK5zZC5lZBfsvqehyzGCZ+DXThuHDSEebLfWoKeQ=; b=F2r19RAwcB+lZdjamhxRofBROfwtlal7OmLhAThAk0ELnDQYlIXJwVphlvLngprcie zq/dy2QlXITIb9oulVJrIX9oEn92/W0NV42ehQxGLLnSQpn5UEx0fVcG81NY0r+jqL99 mG33E9P1XJqdHOWsP0Hpd76oGdYS7ttvnYCv/CPBs9In48EDizlNMzXiFFF6CG5NamcS 7kz0U2mOq4FWwjd8fD1z+z0DgkqRv6HDq9ZzsUZfi19mzTkOyerjx5EeToiYHaJzlzIW 4AdvmXQYMG55YkHqFVf+UPUyH1agwBeqLDlo/0OQ3LkK1IeSBficUIiAldDfF5XRfTrI OE3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iB+TWYmx; 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 fa17-20020a17090af0d100b0025ebac2314asi542003pjb.180.2023.06.22.16.34.36; Thu, 22 Jun 2023 16:34:49 -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=iB+TWYmx; 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 S229853AbjFVWz1 (ORCPT + 99 others); Thu, 22 Jun 2023 18:55:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbjFVWz0 (ORCPT ); Thu, 22 Jun 2023 18:55:26 -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 9C68D1FE6 for ; Thu, 22 Jun 2023 15:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687474478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CoZIUtTkYvBb1iCo4vdxE0rm6LAMYX4km4nzgk6efLk=; b=iB+TWYmxiUk4w7E7yL0TFGwCYZNEy5KNERvydr/Riro9xh6UVGP6nd3zF0VwFzwZalvHig iMnnR2PfqQIOMuYOxUYD0SIJQHQI45Jjl30wszIadR0OIa7aVuQtJug2yVkC35KrgAJIMh oXVx5U6SuXHq/vc1e+Q+sv7UY+orNCI= 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-651-jZIMhQ75NBCZnOxUMJ0HiA-1; Thu, 22 Jun 2023 18:54:34 -0400 X-MC-Unique: jZIMhQ75NBCZnOxUMJ0HiA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B49101C05EBA; Thu, 22 Jun 2023 22:54:33 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14100C1ED97; Thu, 22 Jun 2023 22:54:31 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20230622132835.3c4e38ea@kernel.org> References: <20230622132835.3c4e38ea@kernel.org> <20230622111234.23aadd87@kernel.org> <20230620145338.1300897-1-dhowells@redhat.com> <20230620145338.1300897-2-dhowells@redhat.com> <1952674.1687462843@warthog.procyon.org.uk> To: Jakub Kicinski Cc: dhowells@redhat.com, Eric Dumazet , netdev@vger.kernel.org, Alexander Duyck , "David S. Miller" , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Menglong Dong Subject: Re: [PATCH net-next v3 01/18] net: Copy slab data for sendmsg(MSG_SPLICE_PAGES) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1958076.1687474471.1@warthog.procyon.org.uk> Date: Thu, 22 Jun 2023 23:54:31 +0100 Message-ID: <1958077.1687474471@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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 Jakub Kicinski wrote: > Maybe it's just me but I'd prefer to keep the clear rule that splice > operates on pages not slab objects. sendpage isn't only being used for splice(). Or were you referring to splicing pages into socket buffers more generally? > SIW is the software / fake implementation of RDMA, right? You couldn't have > picked a less important user :( ISCSI and sunrpc could both make use of this, as could ceph and others. I have patches for sunrpc to make it condense into a single bio_vec[] and sendmsg() in the server code (ie. nfsd) but for the moment, Chuck wanted me to just do the xdr payload. > > This offers the opportunity, at least in the future, to append slab data > > to an already-existing private fragment in the skbuff. > > Maybe we can get Eric to comment. The ability to identify "frag type" > seems cool indeed, but I haven't thought about using it to attach > slab objects. Unfortunately, you can't attach slab objects. Their lifetime isn't controlled by put_page() or folio_put(). kmalloc()/kfree() doesn't refcount them - they're recycled immediately. Hence why I was copying them. (Well, you could attach, but then you need a callback mechanism). What I'm trying to do is make it so that the process of calling sock_sendmsg() with MSG_SPLICE_PAGES looks exactly the same as without: You fill in a bio_vec[] pointing to your protocol header, the payload and the trailer, pointing as appropriate to bits of slab, static, stack data or ref'able pages, and call sendmsg and then the data will get copied or spliced as appropriate to the page type, whether the MSG_SPLICE_PAGES flag is supplied and whether the flag is supported. There are a couple of things I'd like to avoid: (1) having to call sock_sendmsg() more than once per message and (2) having sendmsg allocate more space and make a copy of data that you had to copy into a frag before calling sendmsg. David