This patch disables preemption for a very short time, so it doesn't hurt preempt-latency. The author of this solution was Peter Zijlstra. Signed-off-by: John Kacur Index: linux-2.6.26.2-rt1-jk/net/core/sock.c =================================================================== --- linux-2.6.26.2-rt1-jk.orig/net/core/sock.c +++ linux-2.6.26.2-rt1-jk/net/core/sock.c @@ -1943,8 +1943,9 @@ static DECLARE_BITMAP(proto_inuse_idx, P #ifdef CONFIG_NET_NS void sock_prot_inuse_add(struct net *net, struct proto *prot, int val) { - int cpu = smp_processor_id(); + int cpu = get_cpu(); per_cpu_ptr(net->core.inuse, cpu)->val[prot->inuse_idx] += val; + put_cpu(); } EXPORT_SYMBOL_GPL(sock_prot_inuse_add); @@ -1990,7 +1991,9 @@ static DEFINE_PER_CPU(struct prot_inuse, void sock_prot_inuse_add(struct net *net, struct proto *prot, int val) { - __get_cpu_var(prot_inuse).val[prot->inuse_idx] += val; + int cpu = get_cpu(); + per_cpu(prot_inuse, cpu).val[prot->inuse_idx] += val; + put_cpu(); } EXPORT_SYMBOL_GPL(sock_prot_inuse_add);