David S. Miller a écrit :
From: Eric Dumazet <[EMAIL PROTECTED]>
Date: Fri, 26 Aug 2005 03:07:06 +0200
On one of my production machine, tcp_statistics was sitting in a heavily
modified cache line, so *every* SNMP update had to force a reload.
But I disagree that statistics belong in the __read_mostly.
They are write mostly, in fact. :-) Some are incremented every
single packet, and they are per-cpu objects as well.
David I think you missed that statistics are per cpu, so I have to explain why
this patch is usefull.
The patch I suggested only changed the root pointer, moving to read_mostly
section because it is really write once at boot, then read only. This is the
same with slab pointers : they are hot objects (read/written all the time),
but their pointer is written once when kmem_cache_create() is done at boot time.
Let's take a look at tcp_statistics for example:
It is declared in net/ipv4/tcp.c as :
DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics);
this declaration reserve the room for 2 pointers.
Then in net/ipv4/af_inet.c, the init_ipv4_mibs() functions allocates percpu
memory (not in read_mostly data dont worry, but in the right NUMA node)
tcp_statistics[0] = alloc_percpu(struct tcp_mib);
tcp_statistics[1] = alloc_percpu(struct tcp_mib);
So doing :
- DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics);
+ DEFINE_SNMP_STAT(struct tcp_mib, tcp_statistics) __read_mostly;
only move the location of the 2 pointers in read_mostly, not the mibs
themselves.
I'm 100% sure of the validity of my patch, I'm using them since half a month
with great performance increase.
Thank you
I agree with putting kmem cache objects et al. in there, that part
of your patch is fine.
Whilst we discuss the SNMP side of the changes further, why don't
you split out the kmem cache __read_mostly changes because that
isn't controversial and I can apply that immedialte. Ok?
Thanks.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html