Re: unregister_netdevice: waiting for DEV to become free (2)
From: Eric Dumazet
Date: Mon Apr 22 2019 - 12:09:37 EST
On 04/22/2019 09:04 AM, Eric Dumazet wrote:
>
>
> On 04/22/2019 07:58 AM, David Ahern wrote:
>> On 4/21/19 2:41 PM, Stephen Suryaputra wrote:
>>> Hi David,
>>>
>>> I looked at patchwork. This patch hasn't been accepted. Is there a plan
>>> to resubmit? It is very useful. I had to debug refcnt issues multiple
>>> times for my employer.
>>
>> I think the inlined versions of dev_put and dev_hold are better for
>> performance.
However I do not really see dev_put()/dev_hold() being in very hot code paths.
>>
>> I could submit it with a DEBUG config to enable. It has been invaluable
>> to me over the past 3+ years debugging refcount problems.
>>
>
> Sounds a good plan to me :)
>
Another idea would be to track of all dev_hold(), by allocating an unique cookie
and providing the cookie at the corresponding dev_put()
The cookie would also keep track of the stack trace.
This would allow for an automatic finding of the missing release, but at extra cost of course.
This infrastructure would of course being a debug option at kernel build.