summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrzej Hajda <andrzej.hajda@intel.com>2023-06-02 13:21:33 +0300
committerJakub Kicinski <kuba@kernel.org>2023-06-06 01:28:42 +0300
commit7a113ff6355944283402fb617dc97122f68d5a41 (patch)
tree43cf4ce7a6efb9d5672475efbd53b776d5ff0efa /include
parent7877cb91f1081754a1487c144d85dc0d2e2e7fc4 (diff)
downloadlinux-7a113ff6355944283402fb617dc97122f68d5a41.tar.xz
lib/ref_tracker: add unlocked leak print helper
To have reliable detection of leaks, caller must be able to check under the same lock both: tracked counter and the leaks. dir.lock is natural candidate for such lock and unlocked print helper can be called with this lock taken. As a bonus we can reuse this helper in ref_tracker_dir_exit. 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')
-rw-r--r--include/linux/ref_tracker.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/ref_tracker.h b/include/linux/ref_tracker.h
index 9ca353ab712b..87a92f2bec1b 100644
--- a/include/linux/ref_tracker.h
+++ b/include/linux/ref_tracker.h
@@ -36,6 +36,9 @@ static inline void ref_tracker_dir_init(struct ref_tracker_dir *dir,
void ref_tracker_dir_exit(struct ref_tracker_dir *dir);
+void ref_tracker_dir_print_locked(struct ref_tracker_dir *dir,
+ unsigned int display_limit);
+
void ref_tracker_dir_print(struct ref_tracker_dir *dir,
unsigned int display_limit);
@@ -56,6 +59,11 @@ static inline void ref_tracker_dir_exit(struct ref_tracker_dir *dir)
{
}
+static inline void ref_tracker_dir_print_locked(struct ref_tracker_dir *dir,
+ unsigned int display_limit)
+{
+}
+
static inline void ref_tracker_dir_print(struct ref_tracker_dir *dir,
unsigned int display_limit)
{