Thread (52 messages) 52 messages, 8 authors, 2021-12-15

Re: [PATCH v3 net-next 01/23] lib: add reference counting tracking infrastructure

flat view

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-12-08 14:59:49

On Wed, 8 Dec 2021 15:09:17 +0100 Andrzej Hajda wrote:
On 05.12.2021 05:21, Eric Dumazet wrote:
quoted
From: Eric Dumazet <redacted>

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 <redacted>
Reviewed-by: Dmitry Vyukov <dvyukov@google.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.
Something along these lines?

https://lore.kernel.org/all/20211117174723.2305681-1-kuba@kernel.org/ (local)

;)
One more thing about design - as I understand CONFIG_REF_TRACKER turns 
on all trackers in whole kernel, have you considered possibility/helpers 
to enable/disable tracking per class of objects?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help