aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2013-11-15 09:57:53 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2013-12-13 06:55:55 -0500
commit8cf4d6a224a0226987d9cba69cb46d93814fe449 (patch)
tree78944628c08fc8b4f409d80cca43026f8d74c723 /include/net
parent68536053600425c24aba031c45f053d447eedd9c (diff)
net: reorder struct netns_ct for better cache-line usage
Reorder struct netns_ct so that atomic_t "count" changes don't slowdown users of read mostly fields. This is based on Eric Dumazet's proposed patch: "netfilter: conntrack: remove the central spinlock" http://thread.gmane.org/gmane.linux.network/268758/focus=47306 The tricky part of cache-aligning this structure, that it is getting inlined in struct net (include/net/net_namespace.h), thus changes to other netns_xxx structures affects our alignment. Eric's original patch contained an ambiguity on 32-bit regarding alignment in struct net. This patch also takes 32-bit into account, and in case of changed (struct net) alignment sysctl_xxx entries have been ordered according to how often they are accessed. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Reviewed-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netns/conntrack.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index c9c0c538b68b..fbcc7fa536dc 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -65,6 +65,23 @@ struct nf_ip_net {
65struct netns_ct { 65struct netns_ct {
66 atomic_t count; 66 atomic_t count;
67 unsigned int expect_count; 67 unsigned int expect_count;
68#ifdef CONFIG_SYSCTL
69 struct ctl_table_header *sysctl_header;
70 struct ctl_table_header *acct_sysctl_header;
71 struct ctl_table_header *tstamp_sysctl_header;
72 struct ctl_table_header *event_sysctl_header;
73 struct ctl_table_header *helper_sysctl_header;
74#endif
75 char *slabname;
76 unsigned int sysctl_log_invalid; /* Log invalid packets */
77 unsigned int sysctl_events_retry_timeout;
78 int sysctl_events;
79 int sysctl_acct;
80 int sysctl_auto_assign_helper;
81 bool auto_assign_helper_warned;
82 int sysctl_tstamp;
83 int sysctl_checksum;
84
68 unsigned int htable_size; 85 unsigned int htable_size;
69 struct kmem_cache *nf_conntrack_cachep; 86 struct kmem_cache *nf_conntrack_cachep;
70 struct hlist_nulls_head *hash; 87 struct hlist_nulls_head *hash;
@@ -75,14 +92,6 @@ struct netns_ct {
75 struct ip_conntrack_stat __percpu *stat; 92 struct ip_conntrack_stat __percpu *stat;
76 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 93 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
77 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 94 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
78 int sysctl_events;
79 unsigned int sysctl_events_retry_timeout;
80 int sysctl_acct;
81 int sysctl_tstamp;
82 int sysctl_checksum;
83 unsigned int sysctl_log_invalid; /* Log invalid packets */
84 int sysctl_auto_assign_helper;
85 bool auto_assign_helper_warned;
86 struct nf_ip_net nf_ct_proto; 95 struct nf_ip_net nf_ct_proto;
87#if defined(CONFIG_NF_CONNTRACK_LABELS) 96#if defined(CONFIG_NF_CONNTRACK_LABELS)
88 unsigned int labels_used; 97 unsigned int labels_used;
@@ -92,13 +101,5 @@ struct netns_ct {
92 struct hlist_head *nat_bysource; 101 struct hlist_head *nat_bysource;
93 unsigned int nat_htable_size; 102 unsigned int nat_htable_size;
94#endif 103#endif
95#ifdef CONFIG_SYSCTL
96 struct ctl_table_header *sysctl_header;
97 struct ctl_table_header *acct_sysctl_header;
98 struct ctl_table_header *tstamp_sysctl_header;
99 struct ctl_table_header *event_sysctl_header;
100 struct ctl_table_header *helper_sysctl_header;
101#endif
102 char *slabname;
103}; 104};
104#endif 105#endif