diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-13 19:02:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-15 21:12:44 -0400 |
commit | d27f9b35827ec91d71d3561c127a0a8135fb470d (patch) | |
tree | a6a9c67628bf3b807d8bf24375fe6c075b25af32 | |
parent | 2bbdf389a9432270147c8e8e35b021ad61772f65 (diff) |
ip_frag: Remove some atomic ops
Instead of doing one atomic operation per frag, we can factorize them.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/ip_fragment.c | 3 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 75347ea70ea0..963c3689d0af 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -556,7 +556,6 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, | |||
556 | 556 | ||
557 | skb_shinfo(head)->frag_list = head->next; | 557 | skb_shinfo(head)->frag_list = head->next; |
558 | skb_push(head, head->data - skb_network_header(head)); | 558 | skb_push(head, head->data - skb_network_header(head)); |
559 | atomic_sub(head->truesize, &qp->q.net->mem); | ||
560 | 559 | ||
561 | for (fp=head->next; fp; fp = fp->next) { | 560 | for (fp=head->next; fp; fp = fp->next) { |
562 | head->data_len += fp->len; | 561 | head->data_len += fp->len; |
@@ -566,8 +565,8 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, | |||
566 | else if (head->ip_summed == CHECKSUM_COMPLETE) | 565 | else if (head->ip_summed == CHECKSUM_COMPLETE) |
567 | head->csum = csum_add(head->csum, fp->csum); | 566 | head->csum = csum_add(head->csum, fp->csum); |
568 | head->truesize += fp->truesize; | 567 | head->truesize += fp->truesize; |
569 | atomic_sub(fp->truesize, &qp->q.net->mem); | ||
570 | } | 568 | } |
569 | atomic_sub(head->truesize, &qp->q.net->mem); | ||
571 | 570 | ||
572 | head->next = NULL; | 571 | head->next = NULL; |
573 | head->dev = dev; | 572 | head->dev = dev; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 6d4292ff5854..a630506151c3 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -524,7 +524,6 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
524 | skb_shinfo(head)->frag_list = head->next; | 524 | skb_shinfo(head)->frag_list = head->next; |
525 | skb_reset_transport_header(head); | 525 | skb_reset_transport_header(head); |
526 | skb_push(head, head->data - skb_network_header(head)); | 526 | skb_push(head, head->data - skb_network_header(head)); |
527 | atomic_sub(head->truesize, &fq->q.net->mem); | ||
528 | 527 | ||
529 | for (fp=head->next; fp; fp = fp->next) { | 528 | for (fp=head->next; fp; fp = fp->next) { |
530 | head->data_len += fp->len; | 529 | head->data_len += fp->len; |
@@ -534,8 +533,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
534 | else if (head->ip_summed == CHECKSUM_COMPLETE) | 533 | else if (head->ip_summed == CHECKSUM_COMPLETE) |
535 | head->csum = csum_add(head->csum, fp->csum); | 534 | head->csum = csum_add(head->csum, fp->csum); |
536 | head->truesize += fp->truesize; | 535 | head->truesize += fp->truesize; |
537 | atomic_sub(fp->truesize, &fq->q.net->mem); | ||
538 | } | 536 | } |
537 | atomic_sub(head->truesize, &fq->q.net->mem); | ||
539 | 538 | ||
540 | head->next = NULL; | 539 | head->next = NULL; |
541 | head->dev = dev; | 540 | head->dev = dev; |