/* 1 MB per cpu, in page units */
 #define SK_MEMORY_PCPU_RESERVE (1 << (20 - PAGE_SHIFT))
 
-static inline long
+static inline void
 sk_memory_allocated_add(struct sock *sk, int amt)
 {
        int local_reserve;
                atomic_long_add(local_reserve, sk->sk_prot->memory_allocated);
        }
        preempt_enable();
-       return sk_memory_allocated(sk);
 }
 
 static inline void
 
                return -ENOMEM;
 
        /* pre-charge to forward_alloc */
-       allocated = sk_memory_allocated_add(sk, pages);
+       sk_memory_allocated_add(sk, pages);
+       allocated = sk_memory_allocated(sk);
        /* If the system goes into memory pressure with this
         * precharge, give up and return error.
         */
  */
 int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)
 {
-       struct proto *prot = sk->sk_prot;
-       long allocated = sk_memory_allocated_add(sk, amt);
        bool memcg_charge = mem_cgroup_sockets_enabled && sk->sk_memcg;
+       struct proto *prot = sk->sk_prot;
        bool charged = true;
+       long allocated;
 
+       sk_memory_allocated_add(sk, amt);
+       allocated = sk_memory_allocated(sk);
        if (memcg_charge &&
            !(charged = mem_cgroup_charge_skmem(sk->sk_memcg, amt,
                                                gfp_memcg_charge())))