Message ID | 1470651742-15195-3-git-send-email-hejianet@gmail.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
From: Jia He <hejianet@gmail.com> Date: Mon, 8 Aug 2016 18:22:21 +0800 > In PowerPC server with large number cpus, the loop index in smt=1 could be > reduced to 1/8 compared with smt=8. > Thus cache misses can be reduced. You can't do this, if cpus go down we still want to report the statistics they collected while they were up. So we must use the possible cpu list here.
On Mon, 2016-08-08 at 18:22 +0800, Jia He wrote: > In PowerPC server with large number cpus, the loop index in smt=1 could be > reduced to 1/8 compared with smt=8. > Thus cache misses can be reduced. > > Signed-off-by: Jia He <hejianet@gmail.com> > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> > Cc: James Morris <jmorris@namei.org> > Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> > Cc: Patrick McHardy <kaber@trash.net> > --- > net/ipv6/addrconf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c > index 43fa8d0..1fce613 100644 > --- a/net/ipv6/addrconf.c > +++ b/net/ipv6/addrconf.c > @@ -4969,7 +4969,7 @@ static inline void __snmp6_fill_stats64(u64 *stats, void __percpu *mib, > > buff[0] = IPSTATS_MIB_MAX; > > - for_each_possible_cpu(c) { > + for_each_online_cpu(c) { > for (i = 1; i < IPSTATS_MIB_MAX; i++) > buff[i] += snmp_get_cpu_field64(mib, c, i, syncpoff); > } This will break on machines with cpu hotplug.
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 43fa8d0..1fce613 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -4969,7 +4969,7 @@ static inline void __snmp6_fill_stats64(u64 *stats, void __percpu *mib, buff[0] = IPSTATS_MIB_MAX; - for_each_possible_cpu(c) { + for_each_online_cpu(c) { for (i = 1; i < IPSTATS_MIB_MAX; i++) buff[i] += snmp_get_cpu_field64(mib, c, i, syncpoff); }
In PowerPC server with large number cpus, the loop index in smt=1 could be reduced to 1/8 compared with smt=8. Thus cache misses can be reduced. Signed-off-by: Jia He <hejianet@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> Cc: James Morris <jmorris@namei.org> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Cc: Patrick McHardy <kaber@trash.net> --- net/ipv6/addrconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)