From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1BEAC7EE23 for ; Mon, 22 May 2023 14:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbjEVOvB (ORCPT ); Mon, 22 May 2023 10:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjEVOvA (ORCPT ); Mon, 22 May 2023 10:51:00 -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 6291CCA for ; Mon, 22 May 2023 07:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684767015; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JYtoaiOBfTiLctYxaMtqzFI78VjutRXpKlguOTW1tdA=; b=R9pUIg+Hec1YUf0kkQey5Lqkw/sAl5YbGSX619Bz8SDs4U2vtarITGb8JIL0AO7l7T9vgS SUl3u374paArNN7UV0iphOelTMB9pxO6ZVlE0el8qcj5eoYrzGRzxWA4+Sb3mrfZq3eu8A j2ZHABs2djVTPjYNK3V1Rcy91DBqPDU= 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-612-vN46sNt1Pr-bP0jWnEdEQw-1; Mon, 22 May 2023 10:50:09 -0400 X-MC-Unique: vN46sNt1Pr-bP0jWnEdEQw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95F5A800BFF; Mon, 22 May 2023 14:50:08 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA1DC1121314; Mon, 22 May 2023 14:50:05 +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: <20230522102920.0528d821@rorschach.local.home> References: <20230522102920.0528d821@rorschach.local.home> <20230519074047.1739879-1-dhowells@redhat.com> <20230519074047.1739879-24-dhowells@redhat.com> To: Steven Rostedt Cc: dhowells@redhat.com, Jens Axboe , Al Viro , Christoph Hellwig , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , Masami Hiramatsu , linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH v20 23/32] splice: Convert trace/seq to use direct_splice_read() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2812411.1684767005.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 May 2023 15:50:05 +0100 Message-ID: <2812412.1684767005@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Steven Rostedt wrote: > > In the future, something better can probably be done by gifting pages = from > > seq->buf into the pipe, but that would require changing seq->buf into = a > > vmap over an array of pages. > = > If you can give me a POC of what needs to be done, I could possibly > implement it. I wrote my idea up here for Masami[*]: We could implement seq_splice_read(). What we would need to do is to chan= ge how the seq buffer is allocated: bulk allocate a bunch of arbitrary pages which we then vmap(). When we need to splice, we read into the buffer, do= a vunmap() and then splice the pages holding the data we used into the pipe. If we don't manage to splice all the data, we can continue splicing from t= he pages we have left next time. If a read() comes along to view partially spliced data, we would need to copy from the individual pages. When we use up all the data, we discard all the pages we might have splice= d from and shuffle down the other pages, call the bulk allocator to replenis= h the buffer and then vmap() it again. Any pages we've spliced from must be discarded and replaced and not rewrit= ten. If a read() comes without the buffer having been spliced from, it can do a= s it does now. David --- [*] https://lore.kernel.org/linux-fsdevel/20230522-pfund-ferngeblieben-53f= ad9c0e527@brauner/T/#mc03959454c76cc3f29024b092c62d88c90f7c071