Re: [PATCH] Add prefetches in net/ipv4/route.c
From: "David S. Miller" <davem@davemloft.net>
Date: 2005-07-31 03:51:05
From: "David S. Miller" <davem@davemloft.net>
Date: 2005-07-31 03:51:05
From: Eric Dumazet <redacted> Date: Fri, 29 Jul 2005 19:57:35 +0200
nm -v /usr/src/linux/vmlinux | grep -5 rt_cache_stat ffffffff804c6a80 b rover.5 ffffffff804c6a88 b last_gc.2 ffffffff804c6a90 b rover.3 ffffffff804c6a94 b equilibrium.4 ffffffff804c6a98 b ip_fallback_id.7 ffffffff804c6aa0 B rt_cache_stat ffffffff804c6aa8 b ip_rt_max_size ffffffff804c6aac b ip_rt_debug ffffffff804c6ab0 b rt_deadline So rt_cache_stat (which is a read only pointer) is in the middle of a hot cache line (some parts of it are written over and over), that probably ping pong between CPUS.
One cure for this would be to declare it as "__read_mostly", that should help a lot. But it's not the best idea, I think. Instead, we can do away with the pointer and use DECLARE_PERCPU() and __get_cpu_var() for rt_cache_stat. That would emit the most efficient code on every architecture.