Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jeff Layton and committed by
Jakub Kicinski
707bd05b 8f2079f8

+24 -16
+1 -1
drivers/gpu/drm/display/drm_dp_tunnel.c
··· 1920 1920 } 1921 1921 1922 1922 #ifdef CONFIG_DRM_DISPLAY_DP_TUNNEL_STATE_DEBUG 1923 - ref_tracker_dir_init(&mgr->ref_tracker, 16, "drm_dptun", "dptun"); 1923 + ref_tracker_dir_init(&mgr->ref_tracker, 16, "drm_dptun"); 1924 1924 #endif 1925 1925 1926 1926 for (i = 0; i < max_group_count; i++) {
+1 -1
drivers/gpu/drm/i915/intel_runtime_pm.c
··· 61 61 { 62 62 if (!rpm->debug.class) 63 63 ref_tracker_dir_init(&rpm->debug, INTEL_REFTRACK_DEAD_COUNT, 64 - "intel_runtime_pm", dev_name(rpm->kdev)); 64 + "intel_runtime_pm"); 65 65 } 66 66 67 67 static intel_wakeref_t
+1 -1
drivers/gpu/drm/i915/intel_wakeref.c
··· 115 115 116 116 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_WAKEREF) 117 117 if (!wf->debug.class) 118 - ref_tracker_dir_init(&wf->debug, INTEL_REFTRACK_DEAD_COUNT, "intel_wakeref", name); 118 + ref_tracker_dir_init(&wf->debug, INTEL_REFTRACK_DEAD_COUNT, "intel_wakeref"); 119 119 #endif 120 120 } 121 121
+14 -6
include/linux/ref_tracker.h
··· 20 20 struct list_head list; /* List of active trackers */ 21 21 struct list_head quarantine; /* List of dead trackers */ 22 22 const char *class; /* object classname */ 23 - char name[32]; 24 23 #endif 25 24 }; 26 25 ··· 43 44 44 45 #endif /* CONFIG_DEBUG_FS */ 45 46 47 + /** 48 + * ref_tracker_dir_init - initialize a ref_tracker dir 49 + * @dir: ref_tracker_dir to be initialized 50 + * @quarantine_count: max number of entries to be tracked 51 + * @class: pointer to static string that describes object type 52 + * 53 + * Initialize a ref_tracker_dir. If debugfs is configured, then a file 54 + * will also be created for it under the top-level ref_tracker debugfs 55 + * directory. 56 + * 57 + * Note that @class must point to a static string. 58 + */ 46 59 static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir, 47 60 unsigned int quarantine_count, 48 - const char *class, 49 - const char *name) 61 + const char *class) 50 62 { 51 63 INIT_LIST_HEAD(&dir->list); 52 64 INIT_LIST_HEAD(&dir->quarantine); ··· 67 57 refcount_set(&dir->untracked, 1); 68 58 refcount_set(&dir->no_tracker, 1); 69 59 dir->class = class; 70 - strscpy(dir->name, name, sizeof(dir->name)); 71 60 ref_tracker_dir_debugfs(dir); 72 61 stack_depot_init(); 73 62 } ··· 91 82 92 83 static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir, 93 84 unsigned int quarantine_count, 94 - const char *class, 95 - const char *name) 85 + const char *class) 96 86 { 97 87 } 98 88
+3 -3
lib/ref_tracker.c
··· 155 155 stats = ref_tracker_get_stats(dir, display_limit); 156 156 if (IS_ERR(stats)) { 157 157 pr_ostream(s, "%s%s@%p: couldn't get stats, error %pe\n", 158 - s->prefix, dir->name, dir, stats); 158 + s->prefix, dir->class, dir, stats); 159 159 return; 160 160 } 161 161 ··· 166 166 if (sbuf && !stack_depot_snprint(stack, sbuf, STACK_BUF_SIZE, 4)) 167 167 sbuf[0] = 0; 168 168 pr_ostream(s, "%s%s@%p has %d/%d users at\n%s\n", s->prefix, 169 - dir->name, dir, stats->stacks[i].count, 169 + dir->class, dir, stats->stacks[i].count, 170 170 stats->total, sbuf); 171 171 skipped -= stats->stacks[i].count; 172 172 } 173 173 174 174 if (skipped) 175 175 pr_ostream(s, "%s%s@%p skipped reports about %d/%d users.\n", 176 - s->prefix, dir->name, dir, skipped, stats->total); 176 + s->prefix, dir->class, dir, skipped, stats->total); 177 177 178 178 kfree(sbuf); 179 179
+1 -1
lib/test_ref_tracker.c
··· 64 64 { 65 65 int i; 66 66 67 - ref_tracker_dir_init(&ref_dir, 100, "selftest", "selftest"); 67 + ref_tracker_dir_init(&ref_dir, 100, "selftest"); 68 68 69 69 timer_setup(&test_ref_tracker_timer, test_ref_tracker_timer_func, 0); 70 70 mod_timer(&test_ref_tracker_timer, jiffies + 1);
+1 -1
net/core/dev.c
··· 11715 11715 11716 11716 dev->priv_len = sizeof_priv; 11717 11717 11718 - ref_tracker_dir_init(&dev->refcnt_tracker, 128, "netdev", name); 11718 + ref_tracker_dir_init(&dev->refcnt_tracker, 128, "netdev"); 11719 11719 #ifdef CONFIG_PCPU_DEV_REFCNT 11720 11720 dev->pcpu_refcnt = alloc_percpu(int); 11721 11721 if (!dev->pcpu_refcnt)
+2 -2
net/core/net_namespace.c
··· 403 403 { 404 404 refcount_set(&net->passive, 1); 405 405 refcount_set(&net->ns.count, 1); 406 - ref_tracker_dir_init(&net->refcnt_tracker, 128, "net_refcnt", "net_refcnt"); 407 - ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net_notrefcnt", "net_notrefcnt"); 406 + ref_tracker_dir_init(&net->refcnt_tracker, 128, "net_refcnt"); 407 + ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net_notrefcnt"); 408 408 409 409 get_random_bytes(&net->hash_mix, sizeof(u32)); 410 410 net->dev_base_seq = 1;