Re: [PATCH 1/2] debugobject: fix concurrency issues with is_static_object

From: Thomas Gleixner
Date: Fri Mar 03 2023 - 19:14:28 EST


On Sat, Mar 04 2023 at 01:53, Schspa Shi wrote:
> Waiman Long <longman@xxxxxxxxxx> writes:
>>> diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
>>> index 32444686b6ff4..544a6111b97f6 100644
>>> --- a/include/linux/debugobjects.h
>>> +++ b/include/linux/debugobjects.h
>>> @@ -30,6 +30,7 @@ struct debug_obj {
>>> enum debug_obj_state state;
>>> unsigned int astate;
>>> void *object;
>>> + bool is_static;
>>> const struct debug_obj_descr *descr;
>>> };
>>
>> The patch looks reasonable. My main concern is the increase in size of the
>> debug_obj structure. It is an additional 8 bytes on 64-bit arches. How much will
>> we save performance-wise by caching it in the debug_obj. Alternatively, you may
>> pack it within the current size by, maybe, reducing the size of state.
>>
>
> Yes, we can change this to:
>
> struct debug_obj {
> struct hlist_node node;
> struct {
> enum debug_obj_state state : 31;
> bool is_static : 1;
> };

and thereby making debugobjects even more slower than it is right
now. Please check the resulting assembly code before proposing quick
"solutions".

Thanks,

tglx