Skip to content

Commit 1b5ab0d

Browse files
netoptimizerdavem330
authored andcommitted
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: Jesper Dangaard Brouer <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 68399ac commit 1b5ab0d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/net/inet_frag.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
143143
{
144144
spin_lock(&q->net->lru_lock);
145145
list_del(&q->lru_list);
146+
q->net->nqueues--;
146147
spin_unlock(&q->net->lru_lock);
147148
}
148149

@@ -151,6 +152,7 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
151152
{
152153
spin_lock(&nf->lru_lock);
153154
list_add_tail(&q->lru_list, &nf->lru_list);
155+
q->net->nqueues++;
154156
spin_unlock(&nf->lru_lock);
155157
}
156158

net/ipv4/inet_fragment.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f)
124124
{
125125
write_lock(&f->lock);
126126
hlist_del(&fq->list);
127-
fq->net->nqueues--;
128127
write_unlock(&f->lock);
129128
inet_frag_lru_del(fq);
130129
}
@@ -260,7 +259,6 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
260259

261260
atomic_inc(&qp->refcnt);
262261
hlist_add_head(&qp->list, &f->hash[hash]);
263-
nf->nqueues++;
264262
write_unlock(&f->lock);
265263
inet_frag_lru_add(nf, qp);
266264
return qp;

0 commit comments

Comments
 (0)