netdev
[Top] [All Lists]

Re: [PATCH] Add prefetches in net/ipv4/route.c

To: dada1@xxxxxxxxxxxxx
Subject: Re: [PATCH] Add prefetches in net/ipv4/route.c
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Sat, 30 Jul 2005 20:51:05 -0700 (PDT)
Cc: rick.jones2@xxxxxx, netdev@xxxxxxxxxxx, davem@xxxxxxxxxx, Robert.Olsson@xxxxxxxxxxx
In-reply-to: <42EA6E0F.8060705@xxxxxxxxxxxxx>
References: <17130.16951.581026.863431@xxxxxxxxxxxx> <42EA6202.703@xxxxxx> <42EA6E0F.8060705@xxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
From: Eric Dumazet <dada1@xxxxxxxxxxxxx>
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.

<Prev in Thread] Current Thread [Next in Thread>