[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b412674e-5404-dac8-87e6-e9fafe6d0268@gmail.com>
Date: Fri, 3 Nov 2017 16:16:05 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel@...oirfairelinux.com,
"David S. Miller" <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next 03/11] net: dsa: simplify tree reference counting
On 11/03/2017 04:05 PM, Vivien Didelot wrote:
> DSA trees have a refcount used to automatically free the dsa_switch_tree
> structure once there is no switch devices inside of it.
>
> The refcount is incremented when a switch is added to the tree, and
> decremented when it is removed from it.
>
> But because of kref_init, the refcount is also incremented at
> initialization, and when looking up the tree from the list for symmetry.
>
> Thus the current code stores the number of switches plus one, and makes
> the switch registration more complex.
>
> To simplify the switch registration function, we reset the refcount to
> zero after initialization and don't increment it when looking up a tree.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@...oirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
--
Florian
Powered by blists - more mailing lists