aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_frag.h
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2013-01-28 18:45:12 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-29 13:36:24 -0500
commitd433673e5f9180e05a770c4b2ab18c08ad51cc21 (patch)
tree7d71bb8483724418e6a4f48cc4099a8722c704c8 /include/net/inet_frag.h
parent6e34a8b37aca63f109bf990d46131ee07206f5f1 (diff)
net: frag helper functions for mem limit tracking
This change is primarily a preparation to ease the extension of memory limit tracking. The change does reduce the number atomic operation, during freeing of a frag queue. This does introduce a some performance improvement, as these atomic operations are at the core of the performance problems seen on NUMA systems. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/inet_frag.h')
-rw-r--r--include/net/inet_frag.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 8e4c42523f59..f2fabc2a79de 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -79,4 +79,31 @@ static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f
79 inet_frag_destroy(q, f, NULL); 79 inet_frag_destroy(q, f, NULL);
80} 80}
81 81
82/* Memory Tracking Functions. */
83
84static inline int frag_mem_limit(struct netns_frags *nf)
85{
86 return atomic_read(&nf->mem);
87}
88
89static inline void sub_frag_mem_limit(struct inet_frag_queue *q, int i)
90{
91 atomic_sub(i, &q->net->mem);
92}
93
94static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i)
95{
96 atomic_add(i, &q->net->mem);
97}
98
99static inline void init_frag_mem_limit(struct netns_frags *nf)
100{
101 atomic_set(&nf->mem, 0);
102}
103
104static inline int sum_frag_mem_limit(struct netns_frags *nf)
105{
106 return atomic_read(&nf->mem);
107}
108
82#endif 109#endif