Skip to contentSkip to conversation

debugobjects: fix debug_objects_freed accounting

PATCH In review Arnd Bergmann 4 participants 4 messages Feb 22, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 debugobjects: fix debug_objects_freed accounting

The removal of the batched object freeing has caused the debug_objects_freed to become read-only, and the reading is inside an ifdef, so gcc warns that it is completely unused without CONFIG_DEBUG_FS:

lib/debugobjects.c:71:14: error: 'debug_objects_freed' defined but not used [-Werror=unused-variable]

Assuming we are still interested in this number, this adds back code to keep track of the freed objects.

Fixes 636e1970fd7d ("debugobjects: Use global free list in free_object()")

--
v2: simplify the counting as pointed out by Longman

---
 lib/debugobjects.c | 1 +
 1 file changed, 1 insertion(+)
lib/debugobjects.c +1 -0
index faab2c4ea024..105ecfc47d8c 100644
@@ -233,6 +233,7 @@ static void free_obj_work(struct work_struct *work)
 	 */
 	if (obj_nr_tofree) {
 		hlist_move_list(&obj_to_free, &tofree);
+		debug_objects_freed += obj_nr_tofree;
 		obj_nr_tofree = 0;
 	}
 	raw_spin_unlock_irqrestore(&pool_lock, flags);
Signature · 1 line
2.9.0
Acked-by on v2 1/1
#1 lore raw
Quoted 6 lines · Arnd Bergmann

The removal of the batched object freeing has caused the debug_objects_freed to become read-only, and the reading is inside an ifdef, so gcc warns that it is completely unused without CONFIG_DEBUG_FS:

lib/debugobjects.c:71:14: error: 'debug_objects_freed' defined but not used [-Werror=unused-variable]

Quoted 8 lines

Assuming we are still interested in this number, this adds back code to keep track of the freed objects.

Fixes 636e1970fd7d ("debugobjects: Use global free list in free_object()")

--
v2: simplify the counting as pointed out by Longman

Thanks for catching this.

Quoted 16 lines
---
  lib/debugobjects.c | 1 +
  1 file changed, 1 insertion(+)
lib/debugobjects.c +1 -0
index faab2c4ea024..105ecfc47d8c 100644
@@ -233,6 +233,7 @@ static void free_obj_work(struct work_struct *work)
  	 */
  	if (obj_nr_tofree) {
  		hlist_move_list(&obj_to_free, &tofree);
+		debug_objects_freed += obj_nr_tofree;
  		obj_nr_tofree = 0;
  	}
  	raw_spin_unlock_irqrestore(&pool_lock, flags);
Acked-by on v2 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 23 lines · Arnd Bergmann

The removal of the batched object freeing has caused the debug_objects_freed to become read-only, and the reading is inside an ifdef, so gcc warns that it is completely unused without CONFIG_DEBUG_FS:

lib/debugobjects.c:71:14: error: 'debug_objects_freed' defined but not used [-Werror=unused-variable]

Assuming we are still interested in this number, this adds back code to keep track of the freed objects.

Fixes 636e1970fd7d ("debugobjects: Use global free list in free_object()")

--
v2: simplify the counting as pointed out by Longman

---
 lib/debugobjects.c | 1 +
 1 file changed, 1 insertion(+)
lib/debugobjects.c +0 -0
index faab2c4ea024..105ecfc47d8c 100644

lib/debugobjects.c static void free_obj_work(struct work_struct *work) · line 239

Quoted 7 lines
lib/debugobjects.c +1 -0
@@ -233,6 +233,7 @@ static void free_obj_work(struct work_struct *work)
 	 */
 	if (obj_nr_tofree) {
 		hlist_move_list(&obj_to_free, &tofree);
+		debug_objects_freed += obj_nr_tofree;
 		obj_nr_tofree = 0;
 	}
 	raw_spin_unlock_irqrestore(&pool_lock, flags);
#3 lore raw

[tip:core/debugobjects] debugobjects: Fix debug_objects_freed accounting

In reply to Arnd Bergmann
debugobjects: Fix debug_objects_freed accounting
Commit-ID:  04148187aa9df3626168f7429d2287997787e387
Gitweb:     https://git.kernel.org/tip/04148187aa9df3626168f7429d2287997787e387
Author:     Arnd Bergmann <[email protected]>
AuthorDate: Thu, 22 Feb 2018 16:52:58 +0100
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 22 Feb 2018 22:00:24 +0100

debugobjects: Fix debug_objects_freed accounting

The removal of the batched object freeing has caused the debug_objects_freed to become read-only, and the reading is inside an ifdef, so gcc warns that it is completely unused without CONFIG_DEBUG_FS:

lib/debugobjects.c:71:14: error: 'debug_objects_freed' defined but not used [-Werror=unused-variable]

Assuming we are still interested in this number, this adds back code to keep track of the freed objects.

---
 lib/debugobjects.c | 1 +
 1 file changed, 1 insertion(+)
lib/debugobjects.c +1 -0
index faab2c4..105ecfc 100644
@@ -233,6 +233,7 @@ static void free_obj_work(struct work_struct *work)
 	 */
 	if (obj_nr_tofree) {
 		hlist_move_list(&obj_to_free, &tofree);
+		debug_objects_freed += obj_nr_tofree;
 		obj_nr_tofree = 0;
 	}
 	raw_spin_unlock_irqrestore(&pool_lock, flags);