net: sock_free() optimizations
authorEric Dumazet <eric.dumazet@gmail.com>
Sat, 10 Jul 2010 22:45:17 +0000 (22:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Jul 2010 03:21:46 +0000 (20:21 -0700)
Avoid two extra instructions in sock_free(), to reload
skb->truesize and skb->sk

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock.c

index fef2434b7c8c9946cbd52791650682a2ba898b68..363bc260157c60b5a7f61ad6694e216f7d209000 100644 (file)
@@ -1339,9 +1339,10 @@ EXPORT_SYMBOL(sock_wfree);
 void sock_rfree(struct sk_buff *skb)
 {
        struct sock *sk = skb->sk;
+       unsigned int len = skb->truesize;
 
-       atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
-       sk_mem_uncharge(skb->sk, skb->truesize);
+       atomic_sub(len, &sk->sk_rmem_alloc);
+       sk_mem_uncharge(sk, len);
 }
 EXPORT_SYMBOL(sock_rfree);