mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00
ref_tracker: eliminate the ref_tracker_dir name field
Now that we have dentries and the ability to create meaningful symlinks to them, don't keep a name string in each tracker. Switch the output format to print "class@address", and drop the name field. Also, add a kerneldoc header for ref_tracker_dir_init(). Signed-off-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20250618-reftrack-dbgfs-v15-9-24fc37ead144@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8f2079f8da
commit
707bd05be7
8 changed files with 24 additions and 16 deletions
|
@ -1920,7 +1920,7 @@ drm_dp_tunnel_mgr_create(struct drm_device *dev, int max_group_count)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
|
#ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG
|
||||||
ref_tracker_dir_init(&mgr->ref_tracker, 16, "drm_dptun", "dptun");
|
ref_tracker_dir_init(&mgr->ref_tracker, 16, "drm_dptun");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < max_group_count; i++) {
|
for (i = 0; i < max_group_count; i++) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void init_intel_runtime_pm_wakeref(struct intel_runtime_pm *rpm)
|
||||||
{
|
{
|
||||||
if (!rpm->debug.class)
|
if (!rpm->debug.class)
|
||||||
ref_tracker_dir_init(&rpm->debug, INTEL_REFTRACK_DEAD_COUNT,
|
ref_tracker_dir_init(&rpm->debug, INTEL_REFTRACK_DEAD_COUNT,
|
||||||
"intel_runtime_pm", dev_name(rpm->kdev));
|
"intel_runtime_pm");
|
||||||
}
|
}
|
||||||
|
|
||||||
static intel_wakeref_t
|
static intel_wakeref_t
|
||||||
|
|
|
@ -115,7 +115,7 @@ void __intel_wakeref_init(struct intel_wakeref *wf,
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_WAKEREF)
|
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_WAKEREF)
|
||||||
if (!wf->debug.class)
|
if (!wf->debug.class)
|
||||||
ref_tracker_dir_init(&wf->debug, INTEL_REFTRACK_DEAD_COUNT, "intel_wakeref", name);
|
ref_tracker_dir_init(&wf->debug, INTEL_REFTRACK_DEAD_COUNT, "intel_wakeref");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ struct ref_tracker_dir {
|
||||||
struct list_head list; /* List of active trackers */
|
struct list_head list; /* List of active trackers */
|
||||||
struct list_head quarantine; /* List of dead trackers */
|
struct list_head quarantine; /* List of dead trackers */
|
||||||
const char *class; /* object classname */
|
const char *class; /* object classname */
|
||||||
char name[32];
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,10 +43,21 @@ void ref_tracker_dir_symlink(struct ref_tracker_dir *dir, const char *fmt, ...)
|
||||||
|
|
||||||
#endif /* CONFIG_DEBUG_FS */
|
#endif /* CONFIG_DEBUG_FS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ref_tracker_dir_init - initialize a ref_tracker dir
|
||||||
|
* @dir: ref_tracker_dir to be initialized
|
||||||
|
* @quarantine_count: max number of entries to be tracked
|
||||||
|
* @class: pointer to static string that describes object type
|
||||||
|
*
|
||||||
|
* Initialize a ref_tracker_dir. If debugfs is configured, then a file
|
||||||
|
* will also be created for it under the top-level ref_tracker debugfs
|
||||||
|
* directory.
|
||||||
|
*
|
||||||
|
* Note that @class must point to a static string.
|
||||||
|
*/
|
||||||
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
|
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
|
||||||
unsigned int quarantine_count,
|
unsigned int quarantine_count,
|
||||||
const char *class,
|
const char *class)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
INIT_LIST_HEAD(&dir->list);
|
INIT_LIST_HEAD(&dir->list);
|
||||||
INIT_LIST_HEAD(&dir->quarantine);
|
INIT_LIST_HEAD(&dir->quarantine);
|
||||||
|
@ -57,7 +67,6 @@ static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
|
||||||
refcount_set(&dir->untracked, 1);
|
refcount_set(&dir->untracked, 1);
|
||||||
refcount_set(&dir->no_tracker, 1);
|
refcount_set(&dir->no_tracker, 1);
|
||||||
dir->class = class;
|
dir->class = class;
|
||||||
strscpy(dir->name, name, sizeof(dir->name));
|
|
||||||
ref_tracker_dir_debugfs(dir);
|
ref_tracker_dir_debugfs(dir);
|
||||||
stack_depot_init();
|
stack_depot_init();
|
||||||
}
|
}
|
||||||
|
@ -82,8 +91,7 @@ int ref_tracker_free(struct ref_tracker_dir *dir,
|
||||||
|
|
||||||
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
|
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
|
||||||
unsigned int quarantine_count,
|
unsigned int quarantine_count,
|
||||||
const char *class,
|
const char *class)
|
||||||
const char *name)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ __ref_tracker_dir_pr_ostream(struct ref_tracker_dir *dir,
|
||||||
stats = ref_tracker_get_stats(dir, display_limit);
|
stats = ref_tracker_get_stats(dir, display_limit);
|
||||||
if (IS_ERR(stats)) {
|
if (IS_ERR(stats)) {
|
||||||
pr_ostream(s, "%s%s@%p: couldn't get stats, error %pe\n",
|
pr_ostream(s, "%s%s@%p: couldn't get stats, error %pe\n",
|
||||||
s->prefix, dir->name, dir, stats);
|
s->prefix, dir->class, dir, stats);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,14 +166,14 @@ __ref_tracker_dir_pr_ostream(struct ref_tracker_dir *dir,
|
||||||
if (sbuf && !stack_depot_snprint(stack, sbuf, STACK_BUF_SIZE, 4))
|
if (sbuf && !stack_depot_snprint(stack, sbuf, STACK_BUF_SIZE, 4))
|
||||||
sbuf[0] = 0;
|
sbuf[0] = 0;
|
||||||
pr_ostream(s, "%s%s@%p has %d/%d users at\n%s\n", s->prefix,
|
pr_ostream(s, "%s%s@%p has %d/%d users at\n%s\n", s->prefix,
|
||||||
dir->name, dir, stats->stacks[i].count,
|
dir->class, dir, stats->stacks[i].count,
|
||||||
stats->total, sbuf);
|
stats->total, sbuf);
|
||||||
skipped -= stats->stacks[i].count;
|
skipped -= stats->stacks[i].count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipped)
|
if (skipped)
|
||||||
pr_ostream(s, "%s%s@%p skipped reports about %d/%d users.\n",
|
pr_ostream(s, "%s%s@%p skipped reports about %d/%d users.\n",
|
||||||
s->prefix, dir->name, dir, skipped, stats->total);
|
s->prefix, dir->class, dir, skipped, stats->total);
|
||||||
|
|
||||||
kfree(sbuf);
|
kfree(sbuf);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ static int __init test_ref_tracker_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ref_tracker_dir_init(&ref_dir, 100, "selftest", "selftest");
|
ref_tracker_dir_init(&ref_dir, 100, "selftest");
|
||||||
|
|
||||||
timer_setup(&test_ref_tracker_timer, test_ref_tracker_timer_func, 0);
|
timer_setup(&test_ref_tracker_timer, test_ref_tracker_timer_func, 0);
|
||||||
mod_timer(&test_ref_tracker_timer, jiffies + 1);
|
mod_timer(&test_ref_tracker_timer, jiffies + 1);
|
||||||
|
|
|
@ -11715,7 +11715,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
|
||||||
|
|
||||||
dev->priv_len = sizeof_priv;
|
dev->priv_len = sizeof_priv;
|
||||||
|
|
||||||
ref_tracker_dir_init(&dev->refcnt_tracker, 128, "netdev", name);
|
ref_tracker_dir_init(&dev->refcnt_tracker, 128, "netdev");
|
||||||
#ifdef CONFIG_PCPU_DEV_REFCNT
|
#ifdef CONFIG_PCPU_DEV_REFCNT
|
||||||
dev->pcpu_refcnt = alloc_percpu(int);
|
dev->pcpu_refcnt = alloc_percpu(int);
|
||||||
if (!dev->pcpu_refcnt)
|
if (!dev->pcpu_refcnt)
|
||||||
|
|
|
@ -403,8 +403,8 @@ static __net_init void preinit_net(struct net *net, struct user_namespace *user_
|
||||||
{
|
{
|
||||||
refcount_set(&net->passive, 1);
|
refcount_set(&net->passive, 1);
|
||||||
refcount_set(&net->ns.count, 1);
|
refcount_set(&net->ns.count, 1);
|
||||||
ref_tracker_dir_init(&net->refcnt_tracker, 128, "net_refcnt", "net_refcnt");
|
ref_tracker_dir_init(&net->refcnt_tracker, 128, "net_refcnt");
|
||||||
ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net_notrefcnt", "net_notrefcnt");
|
ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net_notrefcnt");
|
||||||
|
|
||||||
get_random_bytes(&net->hash_mix, sizeof(u32));
|
get_random_bytes(&net->hash_mix, sizeof(u32));
|
||||||
net->dev_base_seq = 1;
|
net->dev_base_seq = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue