Benjamin LaHaise a écrit :
On Fri, Aug 26, 2005 at 09:11:14AM +0200, Eric Dumazet wrote:
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.
You should change the definition in net/snmp.h in that case, as that will
make it clear that the pointer is being stored. It also makes the patch
smaller. ;-)
-ben
Hi ben
Been there, tried that :)
Unfortunatly DEFINE_SNMP_STAT is used both as standalone structure
declaration, and embedded in an other struct :
file include/net/if_inet6.h
struct ipv6_devstat {
struct proc_dir_entry *proc_dir_entry;
DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6);
};
And the __read_mostly macro has a meaning on a whole object, not for an
individual field...
So we would have to use 2 definitions in include/net/snmp.h :
#define DEFINE_SNMP_STAT_FIELD(type, name) \
__typeof__(type) *name[2]
#define DEFINE_SNMP_STAT(type, name) \
DEFINE_SNMP_STAT_FIELD(type, name) __read_mostly
and change include/net/if_inet6.h to
struct ipv6_devstat {
struct proc_dir_entry *proc_dir_entry;
- DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6);
+ DEFINE_SNMP_STAT_FIELD(struct icmpv6_mib, icmpv6);
};
Adding a #define in include/net/snmp.h suggest that I would have to push a
patch to linux kernel, for the kmem_cache_t case :
#define DEFINE_KMEM_CACHE(name) kmem_cache_t *name __read_mostly;
#define DEFINE_KMEM_CACHE_FIELD(name) kmem_cache_t *name;
I am not sure such a change would be accepted.
Eric
-
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