Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17]

From: Greg Kroah-Hartman
Date: Tue Mar 03 2020 - 11:37:42 EST


On Tue, Mar 03, 2020 at 08:44:43AM -0700, Jens Axboe wrote:
> On 3/3/20 7:24 AM, Greg Kroah-Hartman wrote:
> > On Tue, Mar 03, 2020 at 03:13:26PM +0100, Jann Horn wrote:
> >> On Tue, Mar 3, 2020 at 3:10 PM Greg Kroah-Hartman
> >> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >>>
> >>> On Tue, Mar 03, 2020 at 02:43:16PM +0100, Greg Kroah-Hartman wrote:
> >>>> On Tue, Mar 03, 2020 at 02:34:42PM +0100, Miklos Szeredi wrote:
> >>>>> On Tue, Mar 3, 2020 at 2:14 PM Greg Kroah-Hartman
> >>>>> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >>>>>
> >>>>>>> Unlimited beers for a 21-line kernel patch? Sign me up!
> >>>>>>>
> >>>>>>> Totally untested, barely compiled patch below.
> >>>>>>
> >>>>>> Ok, that didn't even build, let me try this for real now...
> >>>>>
> >>>>> Some comments on the interface:
> >>>>
> >>>> Ok, hey, let's do this proper :)
> >>>
> >>> Alright, how about this patch.
> >>>
> >>> Actually tested with some simple sysfs files.
> >>>
> >>> If people don't strongly object, I'll add "real" tests to it, hook it up
> >>> to all arches, write a manpage, and all the fun fluff a new syscall
> >>> deserves and submit it "for real".
> >>
> >> Just FYI, io_uring is moving towards the same kind of thing... IIRC
> >> you can already use it to batch a bunch of open() calls, then batch a
> >> bunch of read() calls on all the new fds and close them at the same
> >> time. And I think they're planning to add support for doing
> >> open()+read()+close() all in one go, too, except that it's a bit
> >> complicated because passing forward the file descriptor in a generic
> >> way is a bit complicated.
> >
> > It is complicated, I wouldn't recommend using io_ring for reading a
> > bunch of procfs or sysfs files, that feels like a ton of overkill with
> > too much setup/teardown to make it worth while.
> >
> > But maybe not, will have to watch and see how it goes.
>
> It really isn't, and I too thinks it makes more sense than having a
> system call just for the explicit purpose of open/read/close. As Jann
> said, you can't currently do a linked sequence of open/read/close,
> because the fd passing between them isn't done. But that will come in
> the future. If the use case is "a bunch of files", then you could
> trivially do "open bunch", "read bunch", "close bunch" in three separate
> steps.
>
> Curious what the use case is for this that warrants a special system
> call?

All of the open/read/close cycles for sysfs and procfs files were the
one reported use case as we have lots of utilities that do that all the
time it seems (top and other monitoring tools).

thanks,

greg k-h