From: Matthew Wilcox <willy@infradead.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Yafang Shao <laoar.shao@gmail.com>,
torvalds@linux-foundation.org, viro@zeniv.linux.org.uk,
brauner@kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH RFC] vfs: Introduce a new open flag to imply dentry deletion on file removal
Date: Sun, 15 Sep 2024 23:50:46 +0100 [thread overview]
Message-ID: <Zudkxn7KnWVqkGIm@casper.infradead.org> (raw)
In-Reply-To: <f7bp3ggliqbb7adyysonxgvo6zn76mo4unroagfcuu3bfghynu@7wkgqkfb5c43>
On Thu, Sep 12, 2024 at 01:36:45PM +0200, Mateusz Guzik wrote:
> I have to note what to do with a dentry after unlink is merely a subset
> of the general problem of what to do about negative entries. I had a
> look at it $elsewhere some years back and as one might suspect userspace
> likes to do counterproductive shit. For example it is going to stat a
> non-existent path 2-3 times and then open(..., O_CREAT) on it.
>
> I don't have numbers handy and someone(tm) will need to re-evaluate, but
> crux of the findings was as follows:
> - there is a small subset of negative entries which keep getting tons of
> hits
> - a sizeable count literally does not get any hits after being created
> (aka wastes memory)
> - some negative entries get 2-3 hits and get converted into a positive
> entry afterwards (see that stat shitter)
> - some flip flop with deletion/creation
>
> So whatever magic mechanism, if it wants to mostly not get in the way in
> terms of performance, will have to account for the above.
>
> I ended up with a kludge where negative entries hang out on some number
> of LRU lists and get promoted to a hot list if they manage to get some
> number of hits. The hot list is merely a FIFO and entries there no
> longer count any hits. Removal from the cold LRU also demotes an entry
> from the hot list.
This all reminds me of that paper you pointed me at.
https://arxiv.org/pdf/1512.00727
Summary for the impatient: Use 10% of the memory for a "not yet proven
to be useful" entries, and use multiple Bloom filters to decide which
ones are sufficiently useful to be added to the "more permanent" cache.
I don't think it solves every problem our current dcache implementation
has, but I'm 90% sure it'll be a huge improvement.
next prev parent reply other threads:[~2024-09-15 22:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 9:15 [PATCH RFC] vfs: Introduce a new open flag to imply dentry deletion on file removal Yafang Shao
2024-09-12 10:53 ` Jan Kara
2024-09-12 11:36 ` Mateusz Guzik
2024-09-15 22:50 ` Matthew Wilcox [this message]
2024-09-12 12:04 ` Christian Brauner
2024-09-12 13:32 ` Yafang Shao
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=Zudkxn7KnWVqkGIm@casper.infradead.org \
--to=willy@infradead.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=laoar.shao@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).