From: Al Viro <viro@zeniv.linux.org.uk>
To: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Matthew Wilcox <willy@infradead.org>,
James Bottomley <James.Bottomley@hansenpartnership.com>,
Gao Xiang <hsiangkao@linux.alibaba.com>,
Dave Chinner <david@fromorbit.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Colin Walters <walters@verbum.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] fs/dcache: Add negative-dentry-ratio config
Date: Thu, 31 Mar 2022 19:45:49 +0000 [thread overview]
Message-ID: <YkYE7RXgP8hL9aLd@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <20220331190827.48241-3-stephen.s.brennan@oracle.com>
On Thu, Mar 31, 2022 at 12:08:27PM -0700, Stephen Brennan wrote:
> Negative dentry bloat is a well-known problem. For systems without
> memory pressure, some workloads (like repeated stat calls) can create an
> unbounded amount of negative dentries quite quickly. In the best case,
> these dentries could speed up a subsequent name lookup, but in the worst
> case, they are never used and their memory never freed.
>
> While systems without memory pressure may not need that memory for other
> purposes, negative dentry bloat can have other side-effects, such as
> soft lockups when traversing the d_subdirs list or general slowness with
> managing them. It is a good idea to have some sort of mechanism for
> controlling negative dentries, even outside memory pressure.
>
> This patch attempts to do so in a fair way. Workloads which create many
> negative dentries must create many dentries, or convert dentries from
> positive to negative. Thus, negative dentry management is best done
> during these same operations, as it will amortize its cost, and
> distribute the cost to the perpetrators of the dentry bloat. We
> introduce a sysctl "negative-dentry-ratio" which sets a maximum number
> of negative dentries per positive dentry, N:1. When a dentry is created
> or unlinked, the next N+1 dentries of the parent are scanned. If no
> positive dentries are found, then a candidate negative dentry is killed.
Er... So what's to stop d_move() from leaving you with your cursor
pointer poiting into the list of children of another parent?
What's more, your dentry_unlist() logics will be defeated by that -
if victim used to have a different parent, got moved, then evicted,
it looks like you could end up with old parent cursor pointing
to the victim and left unmodified by dentry_unlist() (since it looks
only at the current parent's cursor). Wait for it to be freed and
voila - access to old parent's cursor will do unpleasant things.
What am I missing here?
next prev parent reply other threads:[~2022-03-31 19:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 19:08 [RFC PATCH 0/2] fs/dcache: Per directory amortized negative dentry pruning Stephen Brennan
2022-03-31 19:08 ` [RFC PATCH 1/2] fs/dcache: make cond_resched in __dentry_kill optional Stephen Brennan
2022-03-31 19:08 ` [RFC PATCH 2/2] fs/dcache: Add negative-dentry-ratio config Stephen Brennan
2022-03-31 19:45 ` Al Viro [this message]
2022-03-31 20:37 ` Stephen Brennan
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=YkYE7RXgP8hL9aLd@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=david@fromorbit.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=stephen.s.brennan@oracle.com \
--cc=walters@verbum.org \
--cc=willy@infradead.org \
/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
all inboxes | Powered by JetHome®