[Devel,rh7,3/3] net: Iterate only online cpus in __snmp6_fill_stats64()

Submitted by Kirill Tkhai on Aug. 25, 2016, 1:37 p.m.

Details

Message ID 147213225043.11396.9531057607906228342.stgit@pro
State New
Series "Series without cover letter"
Headers show

Commit Message

Kirill Tkhai Aug. 25, 2016, 1:37 p.m.
Customers complain, they have a very slow getifaddrs() on their 32-cpu server
comparing to a 4-cpu test machine. They provided a test for measuring of that
(see https://jira.sw.ru/browse/PSBM-50993).

Server has 32 online and 192 possible cpus:

SMP: Allowing 192 CPUs, 160 hotplug CPUs
...
NR_CPUS:4096 nr_cpumask_bits:192 nr_cpu_ids:192 nr_node_ids:2

Investigation shows, using nr_cpus=32 boot parameter improves the results
in 6.5 times. This parameter does not make a cpu offline, just decreases
number of possible cpus.

Since __snmp6_fill_stats64() calculated data are moved from offline cpu,
we may iterate only online cpus here. The patch simply do that.

This problem initially happend on 2.6.32, but 3.10 has the same logic,
so we do the same patch for it.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 net/ipv6/addrconf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5015e41..f5068ba 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4366,7 +4366,7 @@  static inline void __snmp6_fill_stats64(u64 *stats, void __percpu **mib,
 	/* Use put_unaligned() because stats may not be aligned for u64. */
 	put_unaligned(items, &stats[0]);
 	for (i = 1; i < items; i++)
-		put_unaligned(snmp_fold_field64(mib, i, syncpoff), &stats[i]);
+		put_unaligned(__snmp_fold_field64(mib, i, syncpoff, cpu_online_mask), &stats[i]);
 
 	memset(&stats[items], 0, pad);
 }