On Wed, 2015-09-02 at 13:58 -0700, Martin KaFai Lau wrote:
On Tue, Sep 01, 2015 at 01:14:20PM -0700, Eric Dumazet wrote:
quoted
quoted
2. Use a spinlock to protect the dst_cache operations
Well, a seqlock would be better : No need for an atomic operation in
fast path.
seqlock can ensure consistency between idst->dst and idst->cookie.
However, IPv6 dst destruction is not protected by rcu. dst_free() is
directly called, like in ip6_fib.c and a few other places.
Hence, atomic_inc_not_zero() cannot be used here because the dst may
have already been kmem_cache_free() when refcnt is 0.
Really ? What about basic rcu rules ?
Object cannot be freed until all cpus have exited their RCU sections.
A spinlock is
needed to stop the ip6_tnl_dst_set() side from removing the refcnt.
Are you telling me RCU should be banished from the kernel ? ;)