summaryrefslogtreecommitdiffstats
path: root/include/linux/ref_tracker.h
diff options
context:
space:
mode:
authorAndrzej Hajda <andrzej.hajda@intel.com>2023-06-02 12:21:34 +0200
committerJakub Kicinski <kuba@kernel.org>2023-06-05 15:28:42 -0700
commitb6d7c0eb2dcbd238fa233a3a1737654e380e784a (patch)
treea11f410b265ed595980304df26f444c9d5b97828 /include/linux/ref_tracker.h
parent7a113ff6355944283402fb617dc97122f68d5a41 (diff)
downloadlinux-stable-b6d7c0eb2dcbd238fa233a3a1737654e380e784a.tar.gz
linux-stable-b6d7c0eb2dcbd238fa233a3a1737654e380e784a.tar.bz2
linux-stable-b6d7c0eb2dcbd238fa233a3a1737654e380e784a.zip
lib/ref_tracker: improve printing stats
In case the library is tracking busy subsystem, simply printing stack for every active reference will spam log with long, hard to read, redundant stack traces. To improve readabilty following changes have been made: - reports are printed per stack_handle - log is more compact, - added display name for ref_tracker_dir - it will differentiate multiple subsystems, - stack trace is printed indented, in the same printk call, - info about dropped references is printed as well. Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/ref_tracker.h')
-rw-r--r--include/linux/ref_tracker.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/ref_tracker.h b/include/linux/ref_tracker.h
index 87a92f2bec1b..19a69e7809d6 100644
--- a/include/linux/ref_tracker.h
+++ b/include/linux/ref_tracker.h
@@ -17,12 +17,15 @@ struct ref_tracker_dir {
bool dead;
struct list_head list; /* List of active trackers */
struct list_head quarantine; /* List of dead trackers */
+ char name[32];
#endif
};
#ifdef CONFIG_REF_TRACKER
+
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
- unsigned int quarantine_count)
+ unsigned int quarantine_count,
+ const char *name)
{
INIT_LIST_HEAD(&dir->list);
INIT_LIST_HEAD(&dir->quarantine);
@@ -31,6 +34,7 @@ static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
dir->dead = false;
refcount_set(&dir->untracked, 1);
refcount_set(&dir->no_tracker, 1);
+ strscpy(dir->name, name, sizeof(dir->name));
stack_depot_init();
}
@@ -51,7 +55,8 @@ int ref_tracker_free(struct ref_tracker_dir *dir,
#else /* CONFIG_REF_TRACKER */
static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
- unsigned int quarantine_count)
+ unsigned int quarantine_count,
+ const char *name)
{
}