Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

proc: Reduce cache miss in xfrm_statistics_seq_show

This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to
aggregate the data by going through all the items of each cpu sequentially.

Signed-off-by: Jia He <hejianet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jia He and committed by
David S. Miller
07613873 7d64a94b

+8 -2
+8 -2
net/xfrm/xfrm_proc.c
··· 50 50 51 51 static int xfrm_statistics_seq_show(struct seq_file *seq, void *v) 52 52 { 53 + unsigned long buff[LINUX_MIB_XFRMMAX]; 53 54 struct net *net = seq->private; 54 55 int i; 56 + 57 + memset(buff, 0, sizeof(unsigned long) * LINUX_MIB_XFRMMAX); 58 + 59 + snmp_get_cpu_field_batch(buff, xfrm_mib_list, 60 + net->mib.xfrm_statistics); 55 61 for (i = 0; xfrm_mib_list[i].name; i++) 56 62 seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name, 57 - snmp_fold_field(net->mib.xfrm_statistics, 58 - xfrm_mib_list[i].entry)); 63 + buff[i]); 64 + 59 65 return 0; 60 66 } 61 67