From: Ian Kent <raven@themaw.net>
To: Gao Xiang <hsiangkao@linux.alibaba.com>,
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: Wed, 1 Apr 2026 10:21:20 +0800 [thread overview]
Message-ID: <24d86595-a1e8-4fc0-b4e4-7fc62d51049f@themaw.net> (raw)
In-Reply-To: <b04c1c86-100e-467b-b104-7312c4dd0251@linux.alibaba.com>
On 1/4/26 09:47, Gao Xiang wrote:
>
>
> On 2026/4/1 09:38, Ian Kent wrote:
>> On 31/3/26 17:54, Gao Xiang wrote:
>>> Hi,
>>>
>>> On 2026/3/31 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")
>>>>
>>>> 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 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.
>>>
>>> JFYI, another issue we once observed on user workloads is that
>>>
>>> `d_lockref.count` can exceed `int` on very very large
>>> directories in reality (also combined with cached
>>> negative dentries).
Yeah, that's a problem for sure.
I hadn't considered such a large number of dentries so I wasn't
trying to resolve this case and I guess the change here would
only postpone the need to re-think dcache design which I suspect
is what would be needed.
Ian
>>
>> Ouch!
>>
>> So more than 2 Billion?
>
> We received some report.
>
>>
>> I suspect in that case you have much bigger problems than 7 or 8
>>
>> million dentries on the LRU list and linked into the directory.
>
> That shrinker seemed not to be triggered at all
> since the memory was abundant on those bare
> metals; I don't see how it cannot happen with
> enough memory and trigger negative lookups on
> a directory for example.
>
> However, it was a report quite few years ago, but
> I remembered it was a real user report
> (`d_lockref.count` overflowed).
>
> Thanks,
> Gao Xiang
>
>>
>>
>>>
>>> It can be a real overflow, this commit can help but it
>>> doesn't strictly resolve this, anyway.
>>>
>>> Thanks,
>>> Gao Xiang
>
next prev parent reply other threads:[~2026-04-01 2:21 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 [this message]
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
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=24d86595-a1e8-4fc0-b4e4-7fc62d51049f@themaw.net \
--to=raven@themaw.net \
--cc=brauner@kernel.org \
--cc=fsorenso@redhat.com \
--cc=hsiangkao@linux.alibaba.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®