Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1479686
| From | Jia He <hejianet@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH v3 1/7] net:snmp: Introduce generic batch interfaces for snmp_get_cpu_field{,64} |
| Date | 2016-09-09 08:40 +0200 |
| Message-ID | <sfnDI-7Sc-27@gated-at.bofh.it> (permalink) |
| References | <sfnDH-7Sc-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This is to introduced the generic batch interfaces for snmp_get_cpu_field{,64}.
It exchanges the two for-loops for collecting the percpu statistics data.
This can aggregate the data by going through all the items of each cpu
sequentially.
Signed-off-by: Jia He <hejianet@gmail.com>
Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
include/net/ip.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/include/net/ip.h b/include/net/ip.h
index 9742b92..bc43c0f 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -219,6 +219,29 @@ static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_o
}
#endif
+#define snmp_get_cpu_field64_batch(buff64, stats_list, mib_statistic, offset) \
+{ \
+ int i, c; \
+ for_each_possible_cpu(c) { \
+ for (i = 0; stats_list[i].name; i++) \
+ buff64[i] += snmp_get_cpu_field64( \
+ mib_statistic, \
+ c, stats_list[i].entry, \
+ offset); \
+ } \
+}
+
+#define snmp_get_cpu_field_batch(buff, stats_list, mib_statistic) \
+{ \
+ int i, c; \
+ for_each_possible_cpu(c) { \
+ for (i = 0; stats_list[i].name; i++) \
+ buff[i] += snmp_get_cpu_field( \
+ mib_statistic, \
+ c, stats_list[i].entry); \
+ } \
+}
+
void inet_get_local_port_range(struct net *net, int *low, int *high);
#ifdef CONFIG_SYSCTL
--
1.8.3.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH v3 0/7] Reduce cache miss for snmp_fold_field Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
[RFC PATCH v3 4/7] proc: Reduce cache miss in sctp_snmp_seq_show Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
[RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show Marcelo <marcelo.leitner@gmail.com> - 2016-09-12 21:00 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show hejianet <hejianet@gmail.com> - 2016-09-14 05:20 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show hejianet <hejianet@gmail.com> - 2016-09-14 08:00 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show Marcelo <marcelo.leitner@gmail.com> - 2016-09-14 14:00 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show hejianet <hejianet@gmail.com> - 2016-09-21 19:10 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show Marcelo <marcelo.leitner@gmail.com> - 2016-09-21 20:30 +0200
Re: [RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show hejianet <hejianet@gmail.com> - 2016-09-22 07:40 +0200
[RFC PATCH v3 6/7] ipv6: Remove useless parameter in __snmp6_fill_statsdev Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
[RFC PATCH v3 5/7] proc: Reduce cache miss in xfrm_statistics_seq_show Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
[RFC PATCH v3 1/7] net:snmp: Introduce generic batch interfaces for snmp_get_cpu_field{,64} Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
[RFC PATCH v3 3/7] proc: Reduce cache miss in snmp6_seq_show Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
Re: [RFC PATCH v3 3/7] proc: Reduce cache miss in snmp6_seq_show Marcelo <marcelo.leitner@gmail.com> - 2016-09-12 21:10 +0200
Re: [RFC PATCH v3 3/7] proc: Reduce cache miss in snmp6_seq_show hejianet <hejianet@gmail.com> - 2016-09-14 05:20 +0200
[RFC PATCH v3 7/7] net: Suppress the "Comparison to NULL could be written" warning Jia He <hejianet@gmail.com> - 2016-09-09 08:40 +0200
csiph-web