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

proc: Reduce cache miss in sctp_snmp_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
7d64a94b 4a4857b1

+6 -2
+6 -2
net/sctp/proc.c
··· 73 73 /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */ 74 74 static int sctp_snmp_seq_show(struct seq_file *seq, void *v) 75 75 { 76 + unsigned long buff[SCTP_MIB_MAX]; 76 77 struct net *net = seq->private; 77 78 int i; 78 79 80 + memset(buff, 0, sizeof(unsigned long) * SCTP_MIB_MAX); 81 + 82 + snmp_get_cpu_field_batch(buff, sctp_snmp_list, 83 + net->sctp.sctp_statistics); 79 84 for (i = 0; sctp_snmp_list[i].name != NULL; i++) 80 85 seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name, 81 - snmp_fold_field(net->sctp.sctp_statistics, 82 - sctp_snmp_list[i].entry)); 86 + buff[i]); 83 87 84 88 return 0; 85 89 }