Re: [PATCH] net: add a debugfs files for showing netns refcount tracking info
From: Andrew Lunn
Date: Tue Mar 25 2025 - 09:28:02 EST
On Mon, Mar 24, 2025 at 08:37:57PM -0400, Jeff Layton wrote:
> On Mon, 2025-03-24 at 21:50 +0100, Andrew Lunn wrote:
> > On Mon, Mar 24, 2025 at 04:24:47PM -0400, Jeff Layton wrote:
> > > CONFIG_NET_NS_REFCNT_TRACKER currently has no convenient way to display
> > > its tracking info. Add a new net_ns directory in debugfs. Have a
> > > directory in there for every net, with refcnt and notrefcnt files that
> > > show the currently tracked active and passive references.
> >
> > Hi Jeff
> >
> > CONFIG_NET_NS_REFCNT_TRACKER is just an instance of
> > CONFIG_REF_TRACKER.
> >
> > It would be good to explain why you are doing it at the netdev level,
> > rather than part of the generic CONFIG_REF_TRACKER level. Why would
> > other subsystems not benefit from having their reference trackers in
> > debugfs?
> >
> >
>
> Mostly because I just needed the NS_REFCNT_TRACKER at the time.
>
> I'm OK with making this more general, but all of those subsystems using
> refcount trackers would need to add the infrastructure to create
> directories to track them.
The base directory can be created by ref_tracker itself.
> To whit:
>
> What would the directory structure look like for the more general case?
ref_tracker_dir_init(struct ref_tracker_dir *dir,
unsigned int quarantine_count,
const char *name)
and then each tracker use 'name' as the debugfs filename. You would
need to check it is unique before creating it, since uniqueness was
probably not a requirement before.
Andrew