> On 15-Jul-2023, at 2:36 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > !! External Email > > On Thu, 13 Jul 2023 17:03:23 +0530 > Ajay Kaher <akaher@xxxxxxxxxx> wrote: > >> Till now /sys/kernel/debug/tracing/events is a part of tracefs, >> with-in this patch creating 'events' and it's sub-dir as eventfs. >> Basically replacing tracefs calls with eventfs calls for 'events'. > > [ note: /sys/kernel/debug/tracing is deprecated. Please avoid referencing it. ] > > Up until now, /sys/kernel/tracing/events was no different than any other > part of tracefs. The files and directories within the events directory was > created when the tracefs was mounted, and also created for the instances in > /sys/kernel/tracing/instances/<instance>/events. Most of these files and > directories will never be referenced. Since there are thousands of these > files and directories they spend their time wasting precious memory > resources. > > Move the "events" directory to the new eventfs. The eventfs will take the > meta data of the events that they represent and store that. When the files > in the events directory are referenced, the dentry and inodes to represent > them are then created. When the files are no longer referenced, they are > freed. This saves the precious memory resources that were wasted on these > seldom referenced dentries and inodes. > Some correction here: The dentry and inodes to represent eventfs files or directories will be freed only during drop cache or eventfs_remove(). This is same as with other dynamic fs e.g. sysfs or procfs. We can achieve ‘free the dentry and inodes if no longer requires’ using create_file()->d_instantiate_anon() instead create_file()->d_instantiate(), but I faced some issues. This optimisation we may consider in future along with sysfs, procfs. -Ajay