All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] debugobjects: fix debug_objects_freed accounting
@ 2018-02-22 11:45 Arnd Bergmann
  2018-02-22 13:58 ` Waiman Long
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2018-02-22 11:45 UTC (permalink / raw)
  To: Thomas Gleixner, Yang Shi
  Cc: Arnd Bergmann, Ingo Molnar, Waiman Long, linux-kernel

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
count every instance we are about to free while we still hold the spinlock.

Fixes: 636e1970fd7d ("debugobjects: Use global free list in free_object()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 lib/debugobjects.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index faab2c4ea024..748288dba512 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -235,6 +235,9 @@ static void free_obj_work(struct work_struct *work)
 		hlist_move_list(&obj_to_free, &tofree);
 		obj_nr_tofree = 0;
 	}
+	hlist_for_each_entry(obj, &tofree, node)
+		debug_objects_freed++;
+
 	raw_spin_unlock_irqrestore(&pool_lock, flags);
 
 	hlist_for_each_entry_safe(obj, tmp, &tofree, node) {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] debugobjects: fix debug_objects_freed accounting
  2018-02-22 11:45 [PATCH] debugobjects: fix debug_objects_freed accounting Arnd Bergmann
@ 2018-02-22 13:58 ` Waiman Long
  2018-02-22 15:50   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Waiman Long @ 2018-02-22 13:58 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Gleixner, Yang Shi; +Cc: Ingo Molnar, linux-kernel

On 02/22/2018 06:45 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
> count every instance we are about to free while we still hold the spinlock.
>
> Fixes: 636e1970fd7d ("debugobjects: Use global free list in free_object()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  lib/debugobjects.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
> index faab2c4ea024..748288dba512 100644
> --- a/lib/debugobjects.c
> +++ b/lib/debugobjects.c
> @@ -235,6 +235,9 @@ static void free_obj_work(struct work_struct *work)
>  		hlist_move_list(&obj_to_free, &tofree);

It would be simpler to just do:
               debug_objects_freed += obj_nr_tofree;

>  		obj_nr_tofree = 0;
>  	}
> +	hlist_for_each_entry(obj, &tofree, node)
> +		debug_objects_freed++;
> +
>  	raw_spin_unlock_irqrestore(&pool_lock, flags);
>  
>  	hlist_for_each_entry_safe(obj, tmp, &tofree, node) {

-Longman

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] debugobjects: fix debug_objects_freed accounting
  2018-02-22 13:58 ` Waiman Long
@ 2018-02-22 15:50   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-02-22 15:50 UTC (permalink / raw)
  To: Waiman Long
  Cc: Thomas Gleixner, Yang Shi, Ingo Molnar, Linux Kernel Mailing List

On Thu, Feb 22, 2018 at 2:58 PM, Waiman Long <longman@redhat.com> wrote:
> On 02/22/2018 06:45 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
>> count every instance we are about to free while we still hold the spinlock.
>>
>> Fixes: 636e1970fd7d ("debugobjects: Use global free list in free_object()")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  lib/debugobjects.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
>> index faab2c4ea024..748288dba512 100644
>> --- a/lib/debugobjects.c
>> +++ b/lib/debugobjects.c
>> @@ -235,6 +235,9 @@ static void free_obj_work(struct work_struct *work)
>>               hlist_move_list(&obj_to_free, &tofree);
>
> It would be simpler to just do:
>                debug_objects_freed += obj_nr_tofree;
>

Right, I missed that, sending v2 now.

Thanks for the review!

        Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-22 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 11:45 [PATCH] debugobjects: fix debug_objects_freed accounting Arnd Bergmann
2018-02-22 13:58 ` Waiman Long
2018-02-22 15:50   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.