diff mbox

[net-next-2.6] ip_frag: Remove some atomic ops

Message ID 4C163622.7080003@cn.fujitsu.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Shan Wei June 14, 2010, 2:01 p.m. UTC
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(-)

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

Comments

Eric Dumazet June 14, 2010, 2:18 p.m. UTC | #1
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;


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Patrick McHardy June 14, 2010, 2:30 p.m. UTC | #2
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 netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;