Re: [PATCH net-next 01/19] lib: add reference counting tracking infrastructure
flat view
From: Eric Dumazet <hidden>
Date: 2021-12-02 16:05:58
On Thu, Dec 2, 2021 at 12:13 AM Dmitry Vyukov [off-list ref] wrote:
On Thu, 2 Dec 2021 at 04:21, Eric Dumazet [off-list ref] 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>
Thanks !
quoted
+ + if (!tracker) { + refcount_dec(&dir->untracked);Nice approach.
Yes, I found that a boolean was weak, we can do a full refcounted way, Transition from 1 to 0 will generate a warning/stacktrace
quoted
+ return -EEXIST; + } + nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 1); + nr_entries = filter_irq_stacks(entries, nr_entries);Marco sent a patch to do this as part of stack_depot_save() as we spoke: https://lore.kernel.org/lkml/20211130095727.2378739-1-elver@google.com/ (local) I am not sure in what order these patches will reach trees, but ultimately filter_irq_stacks() won't be needed here anymore...
Great, I will keep this in mind, thanks.