LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christian Brauner <christian@brauner.io>,
Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v2 0/2] close_range()
Date: Fri, 24 May 2019 21:39:03 +0300 [thread overview]
Message-ID: <20190524183903.GB2658@avx2> (raw)
In-Reply-To: <CAHk-=wj5YZQ=ox+T1kc4RWp3KP+4VvXzvr8vOBbqcht6cOXufw@mail.gmail.com>
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@gmail.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().
next prev parent reply other threads:[~2019-05-24 18:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 18:21 Alexey Dobriyan
2019-05-23 21:34 ` Linus Torvalds
2019-05-24 10:27 ` Christian Brauner
2019-05-24 18:39 ` Alexey Dobriyan [this message]
2019-05-24 18:55 ` Linus Torvalds
2019-05-24 21:27 ` Alexey Dobriyan
2019-05-24 23:45 ` Al Viro
-- strict thread matches above, loose matches on Subject: below --
2019-05-23 15:47 Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190524183903.GB2658@avx2 \
--to=adobriyan@gmail.com \
--cc=christian@brauner.io \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--subject='Re: [PATCH v2 0/2] close_range()' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).