Commit 1b5ab0de authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by David S. Miller

net: use the frag lru_lock to protect netns_frags.nqueues update

Move the protection of netns_frags.nqueues updates under the LRU_lock,
instead of the write lock.  As they are located on the same cacheline,
and this is also needed when transitioning to use per hash bucket locking.
Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 68399ac3
...@@ -143,6 +143,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q) ...@@ -143,6 +143,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
{ {
spin_lock(&q->net->lru_lock); spin_lock(&q->net->lru_lock);
list_del(&q->lru_list); list_del(&q->lru_list);
q->net->nqueues--;
spin_unlock(&q->net->lru_lock); spin_unlock(&q->net->lru_lock);
} }
...@@ -151,6 +152,7 @@ static inline void inet_frag_lru_add(struct netns_frags *nf, ...@@ -151,6 +152,7 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
{ {
spin_lock(&nf->lru_lock); spin_lock(&nf->lru_lock);
list_add_tail(&q->lru_list, &nf->lru_list); list_add_tail(&q->lru_list, &nf->lru_list);
q->net->nqueues++;
spin_unlock(&nf->lru_lock); spin_unlock(&nf->lru_lock);
} }
......
...@@ -124,7 +124,6 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) ...@@ -124,7 +124,6 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f)
{ {
write_lock(&f->lock); write_lock(&f->lock);
hlist_del(&fq->list); hlist_del(&fq->list);
fq->net->nqueues--;
write_unlock(&f->lock); write_unlock(&f->lock);
inet_frag_lru_del(fq); inet_frag_lru_del(fq);
} }
...@@ -260,7 +259,6 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, ...@@ -260,7 +259,6 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
atomic_inc(&qp->refcnt); atomic_inc(&qp->refcnt);
hlist_add_head(&qp->list, &f->hash[hash]); hlist_add_head(&qp->list, &f->hash[hash]);
nf->nqueues++;
write_unlock(&f->lock); write_unlock(&f->lock);
inet_frag_lru_add(nf, qp); inet_frag_lru_add(nf, qp);
return qp; return qp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment