[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1342735743.2626.5411.camel@edumazet-glaptop>
Date: Fri, 20 Jul 2012 00:09:03 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 10/16] ipv4: Cache output routes in fib_info nexthops.
On Thu, 2012-07-19 at 14:35 -0700, David Miller wrote:
> If we have an output route that lacks nexthop exceptions, we can cache
> it in the FIB info nexthop.
>
> Such routes will have DST_HOST cleared because such routes refer to a
> family of destinations, rather than just one.
>
> The sequence of the handling of exceptions during route lookup is
> adjusted to make the logic work properly.
>
> Before we allocate the route, we lookup the exception.
>
> Then we know if we will cache this route or not, and therefore whether
> DST_HOST should be set on the allocated route.
>
> Then we use DST_HOST to key off whether we should store the resulting
> route, during rt_set_nexthop(), in the FIB nexthop cache.
>
> Signed-off-by: David S. Miller <davem@...emloft.net>
> +static void rt_cache_route(struct fib_nh *nh, struct rtable *rt)
> +{
> + struct rtable *orig, *prev, **p = &nh->nh_rth_output;
> +
> + orig = *p;
> +
> + prev = cmpxchg(p, orig, rt);
> + if (prev == orig) {
> + dst_clone(&rt->dst);
> + if (orig)
> + dst_release(&orig->dst);
> }
> }
>
Hmm...
If we find orig not null, what can protect another cpu from reading
nh->nh_rth_output, then we dst_release(orig), and other cpu does the
dst_use() too late ?
--
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