[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211117162626.72c711c1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 17 Nov 2021 16:26:26 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Eric Dumazet <edumazet@...gle.com>,
"David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>
Subject: Re: [RFC -next 1/2] lib: add reference counting infrastructure
On Wed, 17 Nov 2021 14:43:24 -0800 Eric Dumazet wrote:
> On 11/17/21 12:47 PM, Jakub Kicinski wrote:
> > On Wed, 17 Nov 2021 12:16:15 -0800 Eric Dumazet wrote:
> >> I think that maintaining the tracking state in separate storage would
> >> detect cases where the object has been freed, without the help of KASAN.
> >
> > Makes sense, I guess we can hang more of the information of a secondary
> > object?
> >
> > Maybe I'm missing a trick on how to make the feature consume no space
> > when disabled via Kconfig.
>
> If not enabled in Kconfig, the structures are empty, so consume no space.
>
> Basically this should a nop.
Right, probably not worth going back and forth, example use will clarify
this.
I feel like the two approaches are somewhat complementary, object debug
can help us pin point where ref got freed / lost. Could be useful if
there are many release paths for the same struct.
How do you feel about the struct netdev_ref wrapper I made? Do you
prefer to keep the tracking independent or can we provide the sort of
API I had in mind as well as yours:
void netdev_hold(struct netdev_ref *ref, struct net_device *dev)
void netdev_put(struct netdev_ref *ref)
struct net_device *netdev_ref_ptr(const struct netdev_ref *ref)
(doing both your tracking and object debug behind the scenes)
Powered by blists - more mailing lists