diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2013-01-28 18:45:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-29 13:36:24 -0500 |
commit | 3ef0eb0db4bf92c6d2510fe5c4dc51852746f206 (patch) | |
tree | 3f0d424f598a82eb17a5199d27fec9964513e16e /include | |
parent | 6d7b857d541ecd1d9bd997c97242d4ef94b19de2 (diff) |
net: frag, move LRU list maintenance outside of rwlock
Updating the fragmentation queues LRU (Least-Recently-Used) list,
required taking the hash writer lock. However, the LRU list isn't
tied to the hash at all, so we can use a separate lock for it.
Original-idea-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/inet_frag.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index e0eec7450f15..3f237db0a426 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -6,6 +6,7 @@ | |||
6 | struct netns_frags { | 6 | struct netns_frags { |
7 | int nqueues; | 7 | int nqueues; |
8 | struct list_head lru_list; | 8 | struct list_head lru_list; |
9 | spinlock_t lru_lock; | ||
9 | 10 | ||
10 | /* The percpu_counter "mem" need to be cacheline aligned. | 11 | /* The percpu_counter "mem" need to be cacheline aligned. |
11 | * mem.count must not share cacheline with other writers | 12 | * mem.count must not share cacheline with other writers |
@@ -116,4 +117,25 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf) | |||
116 | return percpu_counter_sum_positive(&nf->mem); | 117 | return percpu_counter_sum_positive(&nf->mem); |
117 | } | 118 | } |
118 | 119 | ||
120 | static inline void inet_frag_lru_move(struct inet_frag_queue *q) | ||
121 | { | ||
122 | spin_lock(&q->net->lru_lock); | ||
123 | list_move_tail(&q->lru_list, &q->net->lru_list); | ||
124 | spin_unlock(&q->net->lru_lock); | ||
125 | } | ||
126 | |||
127 | static inline void inet_frag_lru_del(struct inet_frag_queue *q) | ||
128 | { | ||
129 | spin_lock(&q->net->lru_lock); | ||
130 | list_del(&q->lru_list); | ||
131 | spin_unlock(&q->net->lru_lock); | ||
132 | } | ||
133 | |||
134 | static inline void inet_frag_lru_add(struct netns_frags *nf, | ||
135 | struct inet_frag_queue *q) | ||
136 | { | ||
137 | spin_lock(&nf->lru_lock); | ||
138 | list_add_tail(&q->lru_list, &nf->lru_list); | ||
139 | spin_unlock(&nf->lru_lock); | ||
140 | } | ||
119 | #endif | 141 | #endif |