diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2013-01-28 18:45:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-29 13:36:24 -0500 |
commit | d433673e5f9180e05a770c4b2ab18c08ad51cc21 (patch) | |
tree | 7d71bb8483724418e6a4f48cc4099a8722c704c8 /net/ipv6 | |
parent | 6e34a8b37aca63f109bf990d46131ee07206f5f1 (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 'net/ipv6')
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_reasm.c | 6 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 3dacecc99065..07ef2949c946 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -319,7 +319,7 @@ found: | |||
319 | fq->q.meat += skb->len; | 319 | fq->q.meat += skb->len; |
320 | if (payload_len > fq->q.max_size) | 320 | if (payload_len > fq->q.max_size) |
321 | fq->q.max_size = payload_len; | 321 | fq->q.max_size = payload_len; |
322 | atomic_add(skb->truesize, &fq->q.net->mem); | 322 | add_frag_mem_limit(&fq->q, skb->truesize); |
323 | 323 | ||
324 | /* The first fragment. | 324 | /* The first fragment. |
325 | * nhoffset is obtained from the first fragment, of course. | 325 | * nhoffset is obtained from the first fragment, of course. |
@@ -398,7 +398,7 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct net_device *dev) | |||
398 | clone->ip_summed = head->ip_summed; | 398 | clone->ip_summed = head->ip_summed; |
399 | 399 | ||
400 | NFCT_FRAG6_CB(clone)->orig = NULL; | 400 | NFCT_FRAG6_CB(clone)->orig = NULL; |
401 | atomic_add(clone->truesize, &fq->q.net->mem); | 401 | add_frag_mem_limit(&fq->q, clone->truesize); |
402 | } | 402 | } |
403 | 403 | ||
404 | /* We have to remove fragment header from datagram and to relocate | 404 | /* We have to remove fragment header from datagram and to relocate |
@@ -422,7 +422,7 @@ nf_ct_frag6_reasm(struct frag_queue *fq, struct net_device *dev) | |||
422 | head->csum = csum_add(head->csum, fp->csum); | 422 | head->csum = csum_add(head->csum, fp->csum); |
423 | head->truesize += fp->truesize; | 423 | head->truesize += fp->truesize; |
424 | } | 424 | } |
425 | atomic_sub(head->truesize, &fq->q.net->mem); | 425 | sub_frag_mem_limit(&fq->q, head->truesize); |
426 | 426 | ||
427 | head->local_df = 1; | 427 | head->local_df = 1; |
428 | head->next = NULL; | 428 | head->next = NULL; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index e5253ec9e0fc..18cb8defcdb2 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -327,7 +327,7 @@ found: | |||
327 | } | 327 | } |
328 | fq->q.stamp = skb->tstamp; | 328 | fq->q.stamp = skb->tstamp; |
329 | fq->q.meat += skb->len; | 329 | fq->q.meat += skb->len; |
330 | atomic_add(skb->truesize, &fq->q.net->mem); | 330 | add_frag_mem_limit(&fq->q, skb->truesize); |
331 | 331 | ||
332 | /* The first fragment. | 332 | /* The first fragment. |
333 | * nhoffset is obtained from the first fragment, of course. | 333 | * nhoffset is obtained from the first fragment, of course. |
@@ -429,7 +429,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
429 | head->len -= clone->len; | 429 | head->len -= clone->len; |
430 | clone->csum = 0; | 430 | clone->csum = 0; |
431 | clone->ip_summed = head->ip_summed; | 431 | clone->ip_summed = head->ip_summed; |
432 | atomic_add(clone->truesize, &fq->q.net->mem); | 432 | add_frag_mem_limit(&fq->q, clone->truesize); |
433 | } | 433 | } |
434 | 434 | ||
435 | /* We have to remove fragment header from datagram and to relocate | 435 | /* We have to remove fragment header from datagram and to relocate |
@@ -467,7 +467,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
467 | } | 467 | } |
468 | fp = next; | 468 | fp = next; |
469 | } | 469 | } |
470 | atomic_sub(sum_truesize, &fq->q.net->mem); | 470 | sub_frag_mem_limit(&fq->q, sum_truesize); |
471 | 471 | ||
472 | head->next = NULL; | 472 | head->next = NULL; |
473 | head->dev = dev; | 473 | head->dev = dev; |