mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Christian Brauner <brauner@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Eric Sandeen <sandeen@sandeen.net>,
	Frank Sorenson <fsorenso@redhat.com>,
	Jay Shin <jaeshin@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Yafang Shao <laoar.shao@gmail.com>, Jan Kara <jack@suse.cz>,
	Waiman Long <longman@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Wangkai <wangkai86@huawei.com>,
	Colin Walters <walters@verbum.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] vfs: limit directory child dentry retention
Date: Tue, 7 Apr 2026 20:41:08 +0800	[thread overview]
Message-ID: <06760176-fb65-4fd8-b127-28b25d449b1f@themaw.net> (raw)
In-Reply-To: <20260407-frieden-girlanden-7b761912b2b1@brauner>

On 7/4/26 18:35, Christian Brauner wrote:
> On Wed, Apr 01, 2026 at 10:10:55AM +0800, Ian Kent wrote:
>> On 31/3/26 17:39, Christian Brauner wrote:
>>> On Tue, Mar 31, 2026 at 09:29:09AM +0800, Ian Kent wrote:
>>>> If there's a very large number of children present in a directory dentry
>>>> then the benifit from retaining stale child dentries for re-use can
>>>> become ineffective. Even hashed lookup can become ineffective as hash
>>>> chains grow, time taken to umount a file system can increase a lot, as
>>>> well as child dentry traversals resulting in lock held too long log
>>>> messages.
>>> Fwiw, there's also e6957c99dca5 ("vfs: Add a sysctl for automated deletion of dentry")
>> I'm pretty sure I saw that earlier on but had forgotten about it when I
>>
>> reviewed the bug this time around. It is essentially 681ce8623567 ("vfs:
>>
>> Delete the associated dentry when deleting a file") with opt-in of course.
>>
>>
>>> This patch introduces the concept conditionally, where the associated
>>> dentry is deleted only when the user explicitly opts for it during file
>>> removal. A new sysctl fs.automated_deletion_of_dentry is added for this
>>> purpose. Its default value is set to 0.
>> I meant to update Documentation/admin-guide/sysctl/fs.rst to also say that
>>
>> setting dir-stale-max to 0 disables it. I also get the impression you might
>>
>> feel better about this if the default was 0 as well.
>>
>>
>> The thing that I don't much like with the d_delete() approach is that it
>>
>> fails to cater for files that have been closed and are otherwise unused
>>
>> who's dentries make there way to the LRU eventually resulting in the bad
>>
>> behaviour being discussed.
>>
>>
>>> I have no massive objections to your approach. It feels a bit hacky tbh
>>> as it seems to degrade performance for new workloads in favor old
>>> workloads. The LRU should sort this out though.
>> My aim was to improve performance so I'm a bit puzzled by the comment.
>>
>>
>> The problem is the sheer number of dentry objects and the consequences
>>
>> of that. Hash table chains growing will affect performance, umounting
>>
>> the mount will take ages, and there are cases of child dentry traversals
>>
>> in the VFS. Once you get a large number of stale dentries that necessarily
>>
>> need to stay linked into the structures to get the benefit of caching your
>>
>> exposed to this problem.
>>
>>
>> The LRU mechanism is so far unable to cope with this.
> I meant when when you start limiting the number of negative dentries and
> start to not accumulate more that some workload was relying on this. It
> was just a theoretical musing. That initial "delete on unlink" thing led
> to regressions for a bunch of workloads when we did it unconditionally
> initially.

Yes, I did take that on board.

It's trivial to initially disable it with a doc update describng this.


But this only works (gets accepted) if people think it's worth while and

I'm not sure my proposed case is convincing enough.


Ian


  reply	other threads:[~2026-04-07 12:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31  1:29 [RFC PATCH] Limit " Ian Kent
2026-03-31  1:29 ` [RFC PATCH] vfs: limit " Ian Kent
2026-03-31  9:39   ` Christian Brauner
2026-03-31  9:54     ` Gao Xiang
2026-03-31 14:59       ` Mateusz Guzik
2026-03-31 15:11         ` Gao Xiang
2026-04-01  1:38       ` Ian Kent
2026-04-01  1:47         ` Gao Xiang
2026-04-01  2:21           ` Ian Kent
2026-04-01  2:40             ` Linus Torvalds
2026-04-01  2:10     ` Ian Kent
2026-04-07 10:35       ` Christian Brauner
2026-04-07 12:41         ` Ian Kent [this message]
2026-04-08 10:17           ` Jan Kara
2026-04-09  0:59             ` Ian Kent

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=06760176-fb65-4fd8-b127-28b25d449b1f@themaw.net \
    --to=raven@themaw.net \
    --cc=brauner@kernel.org \
    --cc=fsorenso@redhat.com \
    --cc=jack@suse.cz \
    --cc=jaeshin@redhat.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=miklos@szeredi.hu \
    --cc=sandeen@sandeen.net \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=walters@verbum.org \
    --cc=wangkai86@huawei.com \
    --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®