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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67B0FC77B73 for ; Mon, 22 May 2023 14:50:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6D08900003; Mon, 22 May 2023 10:50:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1C88900002; Mon, 22 May 2023 10:50:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E508900003; Mon, 22 May 2023 10:50:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8F0F7900002 for ; Mon, 22 May 2023 10:50:16 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5F8CE1C6CD4 for ; Mon, 22 May 2023 14:50:16 +0000 (UTC) X-FDA: 80818176432.09.21A71A7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf23.hostedemail.com (Postfix) with ESMTP id 689C2140022 for ; Mon, 22 May 2023 14:50:14 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=g4CcVNma; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684767014; h=from:from:sender: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:dkim-signature; bh=JYtoaiOBfTiLctYxaMtqzFI78VjutRXpKlguOTW1tdA=; b=nWZxsHw4WzQ6WLpXa74nQtyALjQNncv1AfpE7pkA2FICJ2NCX+S4bOmsuGaTlF/6Q+SV+P cKBraaj9j00NZFKznoD2AxmMaIceTWHcVz9QZpeRPGUh/0HiZ8/vVbd0xSF6ctjbiL0FWZ NJGzrWzz7ghAXIT8P60O1JIY/gQwxMk= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=g4CcVNma; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf23.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684767014; a=rsa-sha256; cv=none; b=bInbEeNUNnQa5G4g7fNivjjyEmimNh86JQ0t503+rruTY/mP3OYXWsNabbWwfYMNzBTGBA GxRmc7QugFTTOS2Nso1O1AxK3j4wu+Z0hB5teorjp6N+R/NnamQJNF36tO23YpNaRWIW3M D4b8LlUGT/vrLJrR00O2qodnqXRTZtI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684767013; 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=g4CcVNma19LeQc75MhFRYpePhTCWRl7l9i50DqVqKA8ZiIF/jhZ10Y1uyJv/jKQje41wON yG8lIkRKjKJYjFnNRLmhJ3OoPeXCZ1exv9SK2EN491PMVOGlEFFWBQfPJIr5J1K+5lviy+ +Ad6xJk82PT/43APxx66n87YFkk6q/M= 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 X-Rspam-User: X-Stat-Signature: zkz8uh7gwbiy5b1cwbo8nsrxi9ib58o9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 689C2140022 X-HE-Tag: 1684767014-929167 X-HE-Meta: U2FsdGVkX1/IF32JKomCgZBjPgivqlPJgAdTHOnP98q38GGtNHsZ4mHyDQRzOSwGhzFWtuRM2ZqK0pi87IBf2owQMNfrDd+vSo+A5JcPbtkXhWJ4nwO1NIxoNP8Z1SfMhS6sDUwBSK9U4wT565vvR8GsHEjbb9VXHGOmR4fXPUd9SjUfabjPoHXpW82ZhMTP+FKIaVKifOXvT7tDHs6kUcmmc5k5Irn+fYrCV3J/qgSC3PfmJtpV3Z6CPc3747pOGoqmYXn7pe5//2chmckPxNTFyb8R3P1OXXPXygk3I+9Sq8LIl8cTZXikmz4/cMDUFrSa/k+sQty5o3MxulkgNY9ls8zgW3C+HFqBa1MThTLH6FfgO/uf4zqYEQUnr/FguBsPrnaBpGpqiMTiqWbz7o7ons3FaVKptrsZkrQzAHXbLnzbtmxWNctT6V8AAepaA6riRBttjoinAwguLRxIyisEOIYopw7z4ALrxKOr9Wupnb2NnY+V4HWbSl2FVjk9cxB/ExzERNx/y5yF3mpw2EEX+uvt5eGAQCCLzNXrKSTxQmEkChs7QT94hUhi3lCC9VS13fbd9fYnpvPgJDxdriG/c6oeHOjO5+EDnTQ+yJ6toF/RFjHIe8O67aijfGM3YvfdvHtAwEadjNQ9ctztpDPyBKHixfkWxBw0ReXV57t/NwZWECICQYzPG6UmQkZTXKJrjpM0JUStd5zY+OPqXgh76Boer59vWMF6zv7Db58EPoHtWOjHpP/ut60G4Vui0NTKIHeEFxUBV0rR7n0uQsf/YeJuAm/0QNUXSQmW0LQvAdhv/EbIFmH4xM0p7f884tT8FkHBtCIWcFuFk/PxlZpTGmlu3bASH/k7qajUB7ZdTywiq2YtiMl1ahxc/yzZgzCSeF2dwmGL7YC1AmJTo4d6mAzWBsaCdVmzqe72eHOVagKsuTWYcBgispg5irq7y0LcHJN4rVbP8JY0JqH 8L8ofsrw LGa3DDo1TD0M+WyB3xmoaPoGmyiFp/af60H53aQepSAux1sti+rEMdRWjp7xkWJmDPPrEucGeGvjBExeslJ+IVe7JC9BYwzhV7EPPhkhpb2KJ4wY567cUZHrGbXNeDodihd66f2fSh1nMRuU+Dc2kUlq2vseelaN3lBA9tZfY0XE3+a0b5N+LyzY/gOLwNR1lUKXCViRVApzmVlFDAEzsKNu+qWqzgH/j5LRy3r0hAzYo49FqfzV3z1a7UavyHx1CIqB2KOPDf6/Nm2/QKZmazCnfG+O0Axp+R2cOMQJCYOrl7nSvVtxwft3a2iMncm9mq8AG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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