aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2013-01-28 23:45:51 +0000
committerDavid S. Miller <davem@davemloft.net>2013-01-29 13:36:24 -0500
commit3ef0eb0db4bf92c6d2510fe5c4dc51852746f206 (patch)
tree3f0d424f598a82eb17a5199d27fec9964513e16e /include/net
parentnet: use lib/percpu_counter API for fragmentation mem accounting (diff)
downloadlinux-dev-3ef0eb0db4bf92c6d2510fe5c4dc51852746f206.tar.xz
linux-dev-3ef0eb0db4bf92c6d2510fe5c4dc51852746f206.zip
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/net')
-rw-r--r--include/net/inet_frag.h22
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 @@
struct netns_frags {
int nqueues;
struct list_head lru_list;
+ spinlock_t lru_lock;
/* The percpu_counter "mem" need to be cacheline aligned.
* mem.count must not share cacheline with other writers
@@ -116,4 +117,25 @@ static inline int sum_frag_mem_limit(struct netns_frags *nf)
return percpu_counter_sum_positive(&nf->mem);
}
+static inline void inet_frag_lru_move(struct inet_frag_queue *q)
+{
+ spin_lock(&q->net->lru_lock);
+ list_move_tail(&q->lru_list, &q->net->lru_list);
+ spin_unlock(&q->net->lru_lock);
+}
+
+static inline void inet_frag_lru_del(struct inet_frag_queue *q)
+{
+ spin_lock(&q->net->lru_lock);
+ list_del(&q->lru_list);
+ spin_unlock(&q->net->lru_lock);
+}
+
+static inline void inet_frag_lru_add(struct netns_frags *nf,
+ struct inet_frag_queue *q)
+{
+ spin_lock(&nf->lru_lock);
+ list_add_tail(&q->lru_list, &nf->lru_list);
+ spin_unlock(&nf->lru_lock);
+}
#endif