diff mbox series

[v2] debugobjects: fix debug_objects_freed accounting

Message ID 20180222155335.1647466-1-arnd@arndb.de
State New
Headers show
Series [v2] debugobjects: fix debug_objects_freed accounting | expand

Commit Message

Arnd Bergmann Feb. 22, 2018, 3:52 p.m. UTC
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()")
Suggested-by: Waiman Long <longman@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

--
v2: simplify the counting as pointed out by Longman
---
 lib/debugobjects.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.9.0

Comments

Yang Shi Feb. 22, 2018, 4:02 p.m. UTC | #1
On 2/22/18 7:52 AM, Arnd Bergmann wrote:
> 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()")

> Suggested-by: Waiman Long <longman@redhat.com>

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> --

> v2: simplify the counting as pointed out by Longman


Thanks for catching this.

Acked-by: Yang Shi <yang.shi@linux.alibaba.com>


> ---

>   lib/debugobjects.c | 1 +

>   1 file changed, 1 insertion(+)

>

> diff --git a/lib/debugobjects.c b/lib/debugobjects.c

> index faab2c4ea024..105ecfc47d8c 100644

> --- a/lib/debugobjects.c

> +++ b/lib/debugobjects.c

> @@ -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);
Waiman Long Feb. 22, 2018, 4:09 p.m. UTC | #2
On 02/22/2018 10:52 AM, Arnd Bergmann wrote:
> 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()")

> Suggested-by: Waiman Long <longman@redhat.com>

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> --

> v2: simplify the counting as pointed out by Longman

> ---

>  lib/debugobjects.c | 1 +

>  1 file changed, 1 insertion(+)

>

> diff --git a/lib/debugobjects.c b/lib/debugobjects.c

> index faab2c4ea024..105ecfc47d8c 100644

> --- a/lib/debugobjects.c

> +++ b/lib/debugobjects.c

> @@ -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:  Waiman Long <longman@redhat.com>
diff mbox series

Patch

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index faab2c4ea024..105ecfc47d8c 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -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);