[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2812412.1684767005@warthog.procyon.org.uk>
Date: Mon, 22 May 2023 15:50:05 +0100
From: David Howells <dhowells@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: dhowells@...hat.com, Jens Axboe <axboe@...nel.dk>,
Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
David Hildenbrand <david@...hat.com>,
Jason Gunthorpe <jgg@...dia.com>,
Logan Gunthorpe <logang@...tatee.com>,
Hillf Danton <hdanton@...a.com>,
Christian Brauner <brauner@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Christoph Hellwig <hch@....de>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v20 23/32] splice: Convert trace/seq to use direct_splice_read()
Steven Rostedt <rostedt@...dmis.org> 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 change
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 the
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 spliced
from and shuffle down the other pages, call the bulk allocator to replenish
the buffer and then vmap() it again.
Any pages we've spliced from must be discarded and replaced and not rewritten.
If a read() comes without the buffer having been spliced from, it can do as it
does now.
David
---
[*] https://lore.kernel.org/linux-fsdevel/20230522-pfund-ferngeblieben-53fad9c0e527@brauner/T/#mc03959454c76cc3f29024b092c62d88c90f7c071
Powered by blists - more mailing lists