Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide
[linux-2.6-microblaze.git] / net / core / sock.c
index 415f441..c0b5b2f 100644 (file)
@@ -1469,8 +1469,6 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority,
                sk = kmalloc(prot->obj_size, priority);
 
        if (sk != NULL) {
-               kmemcheck_annotate_bitfield(sk, flags);
-
                if (security_sk_alloc(sk, family, priority))
                        goto out_free;
 
@@ -2346,16 +2344,18 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)
 
        /* guarantee minimum buffer size under pressure */
        if (kind == SK_MEM_RECV) {
-               if (atomic_read(&sk->sk_rmem_alloc) < prot->sysctl_rmem[0])
+               if (atomic_read(&sk->sk_rmem_alloc) < sk_get_rmem0(sk, prot))
                        return 1;
 
        } else { /* SK_MEM_SEND */
+               int wmem0 = sk_get_wmem0(sk, prot);
+
                if (sk->sk_type == SOCK_STREAM) {
-                       if (sk->sk_wmem_queued < prot->sysctl_wmem[0])
+                       if (sk->sk_wmem_queued < wmem0)
                                return 1;
-               } else if (refcount_read(&sk->sk_wmem_alloc) <
-                          prot->sysctl_wmem[0])
+               } else if (refcount_read(&sk->sk_wmem_alloc) < wmem0) {
                                return 1;
+               }
        }
 
        if (sk_has_memory_pressure(sk)) {
@@ -2685,7 +2685,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
        sk_init_common(sk);
        sk->sk_send_head        =       NULL;
 
-       init_timer(&sk->sk_timer);
+       timer_setup(&sk->sk_timer, NULL, 0);
 
        sk->sk_allocation       =       GFP_KERNEL;
        sk->sk_rcvbuf           =       sysctl_rmem_default;
@@ -2744,6 +2744,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
 
        sk->sk_max_pacing_rate = ~0U;
        sk->sk_pacing_rate = ~0U;
+       sk->sk_pacing_shift = 10;
        sk->sk_incoming_cpu = -1;
        /*
         * Before updating sk_refcnt, we must commit prior changes to memory
@@ -3042,7 +3043,6 @@ struct prot_inuse {
 
 static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR);
 
-#ifdef CONFIG_NET_NS
 void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
 {
        __this_cpu_add(net->core.inuse->val[prot->inuse_idx], val);
@@ -3086,27 +3086,6 @@ static __init int net_inuse_init(void)
 }
 
 core_initcall(net_inuse_init);
-#else
-static DEFINE_PER_CPU(struct prot_inuse, prot_inuse);
-
-void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
-{
-       __this_cpu_add(prot_inuse.val[prot->inuse_idx], val);
-}
-EXPORT_SYMBOL_GPL(sock_prot_inuse_add);
-
-int sock_prot_inuse_get(struct net *net, struct proto *prot)
-{
-       int cpu, idx = prot->inuse_idx;
-       int res = 0;
-
-       for_each_possible_cpu(cpu)
-               res += per_cpu(prot_inuse, cpu).val[idx];
-
-       return res >= 0 ? res : 0;
-}
-EXPORT_SYMBOL_GPL(sock_prot_inuse_get);
-#endif
 
 static void assign_proto_idx(struct proto *prot)
 {