neigh: Protect neigh->ha[] with a seqlock

Add a seqlock in struct neighbour to protect neigh->ha[], and avoid
dirtying neighbour in stress situation (many different flows / dsts)

Dirtying takes place because of read_lock(&n->lock) and n->used writes.

Switching to a seqlock, and writing n->used only on jiffies changes
permits less dirtying.

Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Eric Dumazet 2010-10-07 10:44:07 +00:00 • committed by David S. Miller
commit 0ed8ddf404
4 changed files with 51 additions and 26 deletions

View file

@ -241,11 +241,11 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *
}
if (neigh_event_send(n, skb_res) == 0) {
int err;
char haddr[MAX_ADDR_LEN];
read_lock(&n->lock);
err = dev_hard_header(skb, dev, ntohs(skb->protocol),
n->ha, NULL, skb->len);
read_unlock(&n->lock);
neigh_ha_snapshot(haddr, n, dev);
err = dev_hard_header(skb, dev, ntohs(skb->protocol), haddr,
NULL, skb->len);
if (err < 0) {
neigh_release(n);