Re: [LSF/MM TOPIC] Making pseudo file systems inodes/dentries more like normal file systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 26 Jan 2024 06:16:38 -0800
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> On Thu, Jan 25, 2024 at 09:40:07PM -0500, Steven Rostedt wrote:
> > On Thu, 25 Jan 2024 17:59:40 -0800
> > Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >   
> > > > I tried to use kernfs when doing a lot of this and I had issues. I
> > > > don't remember what those were, but I can revisit it.    
> > > 
> > > You might, as kernfs makes it so that the filesystem structures are
> > > created on demand, when accessed, and then removed when memory pressure
> > > happens.  That's what sysfs and configfs and cgroups use quite
> > > successfully.  
> > 
> > kernfs doesn't look trivial and I can't find any documentation on how
> > to use it.  
> 
> You have the code :)

Really Greg?

I can write what I want to do twice as fast than trying to figure out why
someone else did what they did in their code, unless there's good
documentation on the subject.

> 
> > Should there be work to move debugfs over to kernfs?  
> 
> Why?  Are you seeing real actual memory use with debugfs that is causing
> problems?  That is why we made kernfs, because people were seeing this
> in sysfs.

The reason I brought it up was from Linus's comment about dentries and
inodes should not exist if the file system isn't mounted. That's not the
case with debugfs. My question is, do we want debugfs to not use dentries
as its main handle?

> 
> Don't change stuff unless you need to, right?
> 
> > I could look at it too, but as tracefs, and more specifically eventfs,
> > has 10s of thousands of files, I'm very concerned about meta data size.  
> 
> Do you have real numbers?  If not, then don't worry about it :)

I wouldn't be doing any of this without real numbers. They are in the
change log of eventfs.

 See commits:

   27152bceea1df27ffebb12ac9cd9adbf2c4c3f35
   5790b1fb3d672d9a1fe3881a7181dfdbe741568f

> 
> > Currently eventfs keeps a data structure for every directory, but for
> > the files, it only keeps an array of names and callbacks. When a
> > directory is registered, it lists the files it needs. eventfs is
> > specific that the number of files a directory has is always constant,
> > and files will not be removed or added once a directory is created.
> > 
> > This way, the information on how a file is created is done via a
> > callback that was registered when the directory was created.  
> 
> That's fine, and shouldn't matter.
> 
> > For this use case, I don't think kernfs could be used. But I would
> > still like to talk about what I'm trying to accomplish, and perhaps see
> > if there's work that can be done to consolidate what is out there.  
> 
> Again, look at kernfs if you care about the memory usage of your virtual
> filesystem, that's what it is there for, you shouldn't have to reinvent
> the wheel.

Already did because it was much easier than trying to use kernfs without
documentation. I did try at first, and realized it was easier to do it
myself. tracefs was based on top of debugfs, and I saw no easy path to go
from that to kernfs.

> 
> And the best part is, when people find issues with scaling or other
> stuff with kernfs, your filesystem will then benifit (lots of tweaks
> have gone into kernfs for this over the past few kernel releases.)

Code is already done. It would be a huge effort to try to convert it over
to kernfs without even knowing if it will regress the memory issues, which
I believe it would (as the second commit saved 2 megs by getting rid of
meta data per file, which kernfs would bring back).

So, unless there's proof that kernfs would not add that memory footprint
back, I have no time to waste on it.

-- Steve




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux