[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190524183903.GB2658@avx2>
Date: Fri, 24 May 2019 21:39:03 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christian Brauner <christian@...uner.io>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH v2 0/2] close_range()
On Thu, May 23, 2019 at 02:34:31PM -0700, Linus Torvalds wrote:
> On Thu, May 23, 2019 at 11:22 AM Alexey Dobriyan <adobriyan@...il.com> wrote:
> >
> > > This is v2 of this patchset.
> >
> > We've sent fdmap(2) back in the day:
>
> Well, if the main point of the exercise is performance, then fdmap()
> is clearly inferior.
This is not true because there are other usecases.
Current equivalent is readdir() where getdents is essentially bulk fdmap()
with pretty-printing. glibc does getdents into 32KB buffer.
There was a bulk taskstats patch long before meltdown fiasco.
Unfortunately closerange() only closes ranges.
This is why I didn't even tried to send closefrom(2) from OpenBSD.
> Sadly, with all the HW security mitigation, system calls are no longer cheap.
>
> Would there ever be any other reason to traverse unknown open files
> than to close them?
This is what lsof(1) does:
3140 openat(AT_FDCWD, "/proc/29499/fd", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
3140 fstat(4, {st_mode=S_IFDIR|0500, st_size=0, ...}) = 0
3140 getdents(4, /* 6 entries */, 32768) = 144
3140 readlink("/proc/29499/fd/0", "/dev/pts/4", 4096) = 10
3140 lstat("/proc/29499/fd/0", {st_mode=S_IFLNK|0700, st_size=64, ...}) = 0
3140 stat("/proc/29499/fd/0", {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 4), ...}) = 0
3140 openat(AT_FDCWD, "/proc/29499/fdinfo/0", O_RDONLY) = 7
3140 fstat(7, {st_mode=S_IFREG|0400, st_size=0, ...}) = 0
3140 read(7, "pos:\t0\nflags:\t02002\nmnt_id:\t24\n", 1024) = 31
3140 read(7, "", 1024) = 0
3140 close(7)
...
Once fdmap(2) or equivalent is in, more bulk system calls operating on
descriptors can pop up. But closefrom() will remain closefrom().
Powered by blists - more mailing lists