]> git.baikalelectronics.ru Git - kernel.git/commit
neigh: speedup neigh_hh_init()
authorEric Dumazet <eric.dumazet@gmail.com>
Mon, 11 Oct 2010 16:16:57 +0000 (09:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Oct 2010 16:16:57 +0000 (09:16 -0700)
commitb505938604785f0a2978ae34d33e96121a3f3eff
tree77b714a4de7273ec53dac80396b94a2f896cfa95
parenteb16b0d636ad924333a45ceb3b65cf305013bc01
neigh: speedup neigh_hh_init()

When a new dst is used to send a frame, neigh_resolve_output() tries to
associate an struct hh_cache to this dst, calling neigh_hh_init() with
the neigh rwlock write locked.

Most of the time, hh_cache is already known and linked into neighbour,
so we find it and increment its refcount.

This patch changes the logic so that we call neigh_hh_init() with
neighbour lock read locked only, so that fast path can be run in
parallel by concurrent cpus.

This brings part of the speedup we got with commit 2f99b668829ab
(introduce DST_NOCACHE flag) for non cached dsts, even for cached ones,
removing one of the contention point that routers hit on multiqueue
enabled machines.

Further improvements would need to use a seqlock instead of an rwlock to
protect neigh->ha[], to not dirty neigh too often and remove two atomic
ops.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dst.c
net/core/neighbour.c