[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7996aac8-a5cb-d92b-88fe-e4afde5782d1@intel.com>
Date: Wed, 8 Dec 2021 16:04:16 +0100
From: Andrzej Hajda <andrzej.hajda@...el.com>
To: Dmitry Vyukov <dvyukov@...gle.com>
CC: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>, Greg KH <greg@...ah.com>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v3 net-next 01/23] lib: add reference counting tracking
infrastructure
On 08.12.2021 15:27, Dmitry Vyukov wrote:
> On Wed, 8 Dec 2021 at 15:09, Andrzej Hajda <andrzej.hajda@...el.com> wrote:
>> Hi Eric,
>>
>>
>> I've spotted this patchset thanks to LWN, anyway it was merged very
>> quickly, I think it missed more broader review.
>>
>> As the patch touches kernel lib I have added few people who could be
>> interested.
>>
>>
>> On 05.12.2021 05:21, Eric Dumazet wrote:
>>> From: Eric Dumazet <edumazet@...gle.com>
>>>
>>> It can be hard to track where references are taken and released.
>>>
>>> In networking, we have annoying issues at device or netns dismantles,
>>> and we had various proposals to ease root causing them.
>>>
>>> This patch adds new infrastructure pairing refcount increases
>>> and decreases. This will self document code, because programmers
>>> will have to associate increments/decrements.
>>>
>>> This is controled by CONFIG_REF_TRACKER which can be selected
>>> by users of this feature.
>>>
>>> This adds both cpu and memory costs, and thus should probably be
>>> used with care.
>>>
>>> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
>>> Reviewed-by: Dmitry Vyukov <dvyukov@...gle.com>
>>> ---
>>
>> Life is surprising, I was working on my own framework, solving the same
>> issue, with intention to publish it in few days :)
>>
>>
>> My approach was little different:
>>
>> 1. Instead of creating separate framework I have extended debug_objects.
>>
>> 2. There were no additional fields in refcounted object and trackers -
>> infrastructure of debug_objects was reused - debug_objects tracked both
>> pointers of refcounted object and its users.
>>
>> Have you considered using debug_object? it seems to be good place to put
>> it there, I am not sure about performance differences.
> Hi Andrzej,
>
> How exactly did you do it? Do you have a link to your patch?
> There still should be something similar to `struct ref_tracker` in
> this patch, right? Or how do you match decrements with increments and
> understand when a double-decrement happens?
User during taking/dropping reference should pass pointer of the object
who uses the reference (user).
And this pointer is tracked by debug_objects:
- on taking reference: the pointer is added to in-framework array
associated with that reference,
- on dropping reference: framework checks if the pointer is in the
array/quarantine, and the bug is accordingly reported.
- on destroying reference: bug is reported if users array is not empty,
- on taking/dropping reference to non-existing/destroyed object: bug is
reported.
So instead of adding tracker field to user and passing it to the
framework, address of the user itself is passed to the framework.
Regards
Andrzej
Powered by blists - more mailing lists