diff options
Diffstat (limited to 'lib/debugobjects.c')
-rw-r--r-- | lib/debugobjects.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 04c1ef717fe0..d78673e7dc56 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c | |||
@@ -55,6 +55,12 @@ static int debug_objects_enabled __read_mostly | |||
55 | 55 | ||
56 | static struct debug_obj_descr *descr_test __read_mostly; | 56 | static struct debug_obj_descr *descr_test __read_mostly; |
57 | 57 | ||
58 | /* | ||
59 | * Track numbers of kmem_cache_alloc and kmem_cache_free done. | ||
60 | */ | ||
61 | static int debug_objects_alloc; | ||
62 | static int debug_objects_freed; | ||
63 | |||
58 | static void free_obj_work(struct work_struct *work); | 64 | static void free_obj_work(struct work_struct *work); |
59 | static DECLARE_WORK(debug_obj_work, free_obj_work); | 65 | static DECLARE_WORK(debug_obj_work, free_obj_work); |
60 | 66 | ||
@@ -102,6 +108,7 @@ static void fill_pool(void) | |||
102 | 108 | ||
103 | raw_spin_lock_irqsave(&pool_lock, flags); | 109 | raw_spin_lock_irqsave(&pool_lock, flags); |
104 | hlist_add_head(&new->node, &obj_pool); | 110 | hlist_add_head(&new->node, &obj_pool); |
111 | debug_objects_alloc++; | ||
105 | obj_pool_free++; | 112 | obj_pool_free++; |
106 | raw_spin_unlock_irqrestore(&pool_lock, flags); | 113 | raw_spin_unlock_irqrestore(&pool_lock, flags); |
107 | } | 114 | } |
@@ -173,6 +180,7 @@ static void free_obj_work(struct work_struct *work) | |||
173 | obj = hlist_entry(obj_pool.first, typeof(*obj), node); | 180 | obj = hlist_entry(obj_pool.first, typeof(*obj), node); |
174 | hlist_del(&obj->node); | 181 | hlist_del(&obj->node); |
175 | obj_pool_free--; | 182 | obj_pool_free--; |
183 | debug_objects_freed++; | ||
176 | /* | 184 | /* |
177 | * We release pool_lock across kmem_cache_free() to | 185 | * We release pool_lock across kmem_cache_free() to |
178 | * avoid contention on pool_lock. | 186 | * avoid contention on pool_lock. |
@@ -758,6 +766,8 @@ static int debug_stats_show(struct seq_file *m, void *v) | |||
758 | seq_printf(m, "pool_min_free :%d\n", obj_pool_min_free); | 766 | seq_printf(m, "pool_min_free :%d\n", obj_pool_min_free); |
759 | seq_printf(m, "pool_used :%d\n", obj_pool_used); | 767 | seq_printf(m, "pool_used :%d\n", obj_pool_used); |
760 | seq_printf(m, "pool_max_used :%d\n", obj_pool_max_used); | 768 | seq_printf(m, "pool_max_used :%d\n", obj_pool_max_used); |
769 | seq_printf(m, "objects_alloc :%d\n", debug_objects_alloc); | ||
770 | seq_printf(m, "objects_freed :%d\n", debug_objects_freed); | ||
761 | return 0; | 771 | return 0; |
762 | } | 772 | } |
763 | 773 | ||