Re: [RFC PATCH] vfs: limit directory child dentry retention
From: Gao Xiang
Date: Tue Mar 31 2026 - 11:13:53 EST
Hi,
On 2026/3/31 22:59, Mateusz Guzik wrote:
On Tue, Mar 31, 2026 at 05:54:01PM +0800, Gao Xiang wrote:
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).
It can be a real overflow, this commit can help but it
doesn't strictly resolve this, anyway.
Another way to contribute to the problem is to mass open the same file,
which results in one ref per fd.
Or to put it differently, sooner or later the dentry refcount will have
to switch to 64 bits on 64 bit systems.
Yes, but my own basic question on this is that do we
really need 64-bit refcount for each dentry?
- do we need to cache so many child dentries at the
same time? some real use case?
- do we need to cache so many negative dentries for
a single directory?
- do we need to really care mass open the same file?
or just find a way to error out blindly when the
refcount is nearly overflowed? together with this
retain_dentry() change to make cached dentries
in the low watermark.
just my .2 cents since currently I don't work on
vfs stuffs.
Thanks,
Gao Xiang