All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] ip_frag: Remove some atomic ops
@ 2010-06-14  9:02 Eric Dumazet
  2010-06-14 14:01 ` Shan Wei
  2010-06-16  1:13 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2010-06-14  9:02 UTC (permalink / raw
  To: David Miller; +Cc: netdev

Instead of doing one atomic operation per frag, we can factorize them.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv4/ip_fragment.c |    3 +--
 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 75347ea..963c368 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,
 
 	skb_shinfo(head)->frag_list = head->next;
 	skb_push(head, head->data - skb_network_header(head));
-	atomic_sub(head->truesize, &qp->q.net->mem);
 
 	for (fp=head->next; fp; fp = fp->next) {
 		head->data_len += fp->len;
@@ -566,8 +565,8 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
 		else if (head->ip_summed == CHECKSUM_COMPLETE)
 			head->csum = csum_add(head->csum, fp->csum);
 		head->truesize += fp->truesize;
-		atomic_sub(fp->truesize, &qp->q.net->mem);
 	}
+	atomic_sub(head->truesize, &qp->q.net->mem);
 
 	head->next = NULL;
 	head->dev = dev;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 6d4292f..a630506 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,
 	skb_shinfo(head)->frag_list = head->next;
 	skb_reset_transport_header(head);
 	skb_push(head, head->data - skb_network_header(head));
-	atomic_sub(head->truesize, &fq->q.net->mem);
 
 	for (fp=head->next; fp; fp = fp->next) {
 		head->data_len += fp->len;
@@ -534,8 +533,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
 		else if (head->ip_summed == CHECKSUM_COMPLETE)
 			head->csum = csum_add(head->csum, fp->csum);
 		head->truesize += fp->truesize;
-		atomic_sub(fp->truesize, &fq->q.net->mem);
 	}
+	atomic_sub(head->truesize, &fq->q.net->mem);
 
 	head->next = NULL;
 	head->dev = dev;



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next-2.6] ip_frag: Remove some atomic ops
  2010-06-14  9:02 [PATCH net-next-2.6] ip_frag: Remove some atomic ops Eric Dumazet
@ 2010-06-14 14:01 ` Shan Wei
  2010-06-14 14:18   ` Eric Dumazet
  2010-06-16  1:13 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Shan Wei @ 2010-06-14 14:01 UTC (permalink / raw
  To: Eric Dumazet; +Cc: David Miller, netdev, Patrick McHardy, netfilter-devel

Eric Dumazet wrote, at 06/14/2010 05:02 PM:
> Instead of doing one atomic operation per frag, we can factorize them.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

IPv6 netfilter has implemented owns queue to manage/reassemble defragments.
So, you miss this one.

[PATCH 1/2] netfilter: defrag: remove one redundant atomic ops

Instead of doing one atomic operation per frag, we can factorize them.
Reported from Eric Dumazet.

Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 net/ipv6/netfilter/nf_conntrack_reasm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 6fb8901..bc5b86d 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -442,7 +442,6 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
 	skb_shinfo(head)->frag_list = head->next;
 	skb_reset_transport_header(head);
 	skb_push(head, head->data - skb_network_header(head));
-	atomic_sub(head->truesize, &nf_init_frags.mem);
 
 	for (fp=head->next; fp; fp = fp->next) {
 		head->data_len += fp->len;
@@ -452,8 +451,8 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
 		else if (head->ip_summed == CHECKSUM_COMPLETE)
 			head->csum = csum_add(head->csum, fp->csum);
 		head->truesize += fp->truesize;
-		atomic_sub(fp->truesize, &nf_init_frags.mem);
 	}
+	atomic_sub(head->truesize, &nf_init_frags.mem);
 
 	head->next = NULL;
 	head->dev = dev;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next-2.6] ip_frag: Remove some atomic ops
  2010-06-14 14:01 ` Shan Wei
@ 2010-06-14 14:18   ` Eric Dumazet
  2010-06-14 14:30     ` Patrick McHardy
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2010-06-14 14:18 UTC (permalink / raw
  To: Shan Wei; +Cc: David Miller, netdev, Patrick McHardy, netfilter-devel

Le lundi 14 juin 2010 à 22:01 +0800, Shan Wei a écrit :
> Eric Dumazet wrote, at 06/14/2010 05:02 PM:
> > Instead of doing one atomic operation per frag, we can factorize them.
> > 
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> IPv6 netfilter has implemented owns queue to manage/reassemble defragments.
> So, you miss this one.
> 

Not exactly missed, its only a different thing :)

I prefer to separate if possible net patches (David) and netfilter ones
(Patrick), because of delay between git trees.

> [PATCH 1/2] netfilter: defrag: remove one redundant atomic ops
> 
> Instead of doing one atomic operation per frag, we can factorize them.
> Reported from Eric Dumazet.
> 
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

> ---
>  net/ipv6/netfilter/nf_conntrack_reasm.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
> index 6fb8901..bc5b86d 100644
> --- a/net/ipv6/netfilter/nf_conntrack_reasm.c
> +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
> @@ -442,7 +442,6 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
>  	skb_shinfo(head)->frag_list = head->next;
>  	skb_reset_transport_header(head);
>  	skb_push(head, head->data - skb_network_header(head));
> -	atomic_sub(head->truesize, &nf_init_frags.mem);
>  
>  	for (fp=head->next; fp; fp = fp->next) {
>  		head->data_len += fp->len;
> @@ -452,8 +451,8 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
>  		else if (head->ip_summed == CHECKSUM_COMPLETE)
>  			head->csum = csum_add(head->csum, fp->csum);
>  		head->truesize += fp->truesize;
> -		atomic_sub(fp->truesize, &nf_init_frags.mem);
>  	}
> +	atomic_sub(head->truesize, &nf_init_frags.mem);
>  
>  	head->next = NULL;
>  	head->dev = dev;



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next-2.6] ip_frag: Remove some atomic ops
  2010-06-14 14:18   ` Eric Dumazet
@ 2010-06-14 14:30     ` Patrick McHardy
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2010-06-14 14:30 UTC (permalink / raw
  To: Eric Dumazet; +Cc: Shan Wei, David Miller, netdev, netfilter-devel

Eric Dumazet wrote:
> Le lundi 14 juin 2010 à 22:01 +0800, Shan Wei a écrit :
>   
>> [PATCH 1/2] netfilter: defrag: remove one redundant atomic ops
>>
>> Instead of doing one atomic operation per frag, we can factorize them.
>> Reported from Eric Dumazet.
>>
>> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
>>     
>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
>   

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next-2.6] ip_frag: Remove some atomic ops
  2010-06-14  9:02 [PATCH net-next-2.6] ip_frag: Remove some atomic ops Eric Dumazet
  2010-06-14 14:01 ` Shan Wei
@ 2010-06-16  1:13 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2010-06-16  1:13 UTC (permalink / raw
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 14 Jun 2010 11:02:24 +0200

> Instead of doing one atomic operation per frag, we can factorize them.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-16  1:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-14  9:02 [PATCH net-next-2.6] ip_frag: Remove some atomic ops Eric Dumazet
2010-06-14 14:01 ` Shan Wei
2010-06-14 14:18   ` Eric Dumazet
2010-06-14 14:30     ` Patrick McHardy
2010-06-16  1:13 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.