Re: [PATCHSET v2 0/15] Uncached buffered IO
From: Yu Zhao
Date: Mon Nov 11 2024 - 16:34:24 EST
On Mon, Nov 11, 2024 at 10:25 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Sun, Nov 10, 2024 at 08:27:52AM -0700, Jens Axboe wrote:
> > 5 years ago I posted patches adding support for RWF_UNCACHED, as a way
> > to do buffered IO that isn't page cache persistent. The approach back
> > then was to have private pages for IO, and then get rid of them once IO
> > was done. But that then runs into all the issues that O_DIRECT has, in
> > terms of synchronizing with the page cache.
>
> Today's a holiday, and I suspect you're going to do a v3 before I have
> a chance to do a proper review of this version of the series.
>
> I think "uncached" isn't quite the right word. Perhaps 'RWF_STREAMING'
> so that userspace is indicating that this is a streaming I/O and the
> kernel gets to choose what to do with that information.
>
> Also, do we want to fail I/Os to filesystems which don't support
> it? I suppose really sophisticated userspace might fall back to
> madvise(DONTNEED), but isn't most userspace going to just clear the flag
> and retry the I/O?
>
> Um. Now I've looked, we also have posix_fadvise(POSIX_FADV_NOREUSE),
> which is currently a noop.
Just to clarify that NOREUSE is NOT a noop since commit 17e8102 ("mm:
support POSIX_FADV_NOREUSE"). And it had at least one user (we made
the userpspace change after the kernel supported it): SVT-AV1 [1]; it
was also added to FIO for testing purposes.
[1] https://gitlab.com/AOMediaCodec/SVT-AV1
> But would we be better off honouring
> POSIX_FADV_NOREUSE than introducing RWF_UNCACHED? I'll think about this
> some more while I'm offline.
But I guess the flag isn't honored the way UNCACHED works?