[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120726.011853.973075299731735416.davem@davemloft.net>
Date: Thu, 26 Jul 2012 01:18:53 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: alexander.duyck@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH 00/16] Remove the ipv4 routing cache
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Thu, 26 Jul 2012 10:13:34 +0200
> On Wed, 2012-07-25 at 17:54 -0700, David Miller wrote:
>> @@ -1216,9 +1215,15 @@ static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
>>
>> prev = cmpxchg(p, orig, rt);
>> if (prev == orig) {
>> - dst_clone(&rt->dst);
>> if (orig)
>> - call_rcu_bh(&orig->dst.rcu_head, rt_release_rcu);
>> + rt_free(orig);
>> + } else {
>> + /* Routes we intend to cache in the FIB nexthop have
>> + * the DST_NOCACHE bit set. However, if we are
>> + * unsuccessful at storing this route into the cache
>> + * we really need to clear that bit.
>> + */
>> + rt->dst.flags &= ~DST_NOCACHE;
>> }
>> }
>>
>
> Not sure why you removed the dst_clone(&rt->dst) ?
Because "cached" dst objects have no reference count. When such a
cached dst is "released", it is dst_free()'d instead of
dst_release()'d.
> If it is not needed, we might need to release a reference in the else {}
> clause, no ?
Nope. 'rt' has a reference count of one, which is for the caller, not
for this cached location.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists