diff options
author | Eric Dumazet <edumazet@google.com> | 2013-06-13 10:58:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-13 20:17:02 -0400 |
commit | ca4ec90b31d1ecf01087c607933cf792057bc8bf (patch) | |
tree | f629cdb10f0eafc1b1979daf34698db1d90a08fb /net/sched/sch_htb.c | |
parent | 5f121b9a83b499a61ed44e5ba619c7de8f7271ad (diff) |
htb: reorder struct htb_class fields for performance
htb_class structures are big, and source of false sharing on SMP.
By carefully splitting them in two parts, we can improve performance.
I got 9 % performance increase on a 24 threads machine, with 200
concurrent netperf in TCP_RR mode, using a HTB hierarchy of 4 classes.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r-- | net/sched/sch_htb.c | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 1a3655a606c1..7954e73d118a 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -76,23 +76,39 @@ enum htb_cmode { | |||
76 | HTB_CAN_SEND /* class can send */ | 76 | HTB_CAN_SEND /* class can send */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | /* interior & leaf nodes; props specific to leaves are marked L: */ | 79 | /* interior & leaf nodes; props specific to leaves are marked L: |
80 | * To reduce false sharing, place mostly read fields at beginning, | ||
81 | * and mostly written ones at the end. | ||
82 | */ | ||
80 | struct htb_class { | 83 | struct htb_class { |
81 | struct Qdisc_class_common common; | 84 | struct Qdisc_class_common common; |
82 | /* general class parameters */ | 85 | struct psched_ratecfg rate; |
83 | struct gnet_stats_basic_packed bstats; | 86 | struct psched_ratecfg ceil; |
84 | struct gnet_stats_queue qstats; | 87 | s64 buffer, cbuffer;/* token bucket depth/rate */ |
88 | s64 mbuffer; /* max wait time */ | ||
89 | int prio; /* these two are used only by leaves... */ | ||
90 | int quantum; /* but stored for parent-to-leaf return */ | ||
91 | |||
92 | struct tcf_proto *filter_list; /* class attached filters */ | ||
93 | int filter_cnt; | ||
94 | int refcnt; /* usage count of this class */ | ||
95 | |||
96 | int level; /* our level (see above) */ | ||
97 | unsigned int children; | ||
98 | struct htb_class *parent; /* parent class */ | ||
99 | |||
85 | struct gnet_stats_rate_est64 rate_est; | 100 | struct gnet_stats_rate_est64 rate_est; |
86 | struct tc_htb_xstats xstats; /* our special stats */ | ||
87 | int refcnt; /* usage count of this class */ | ||
88 | 101 | ||
89 | /* topology */ | 102 | /* |
90 | int level; /* our level (see above) */ | 103 | * Written often fields |
91 | unsigned int children; | 104 | */ |
92 | struct htb_class *parent; /* parent class */ | 105 | struct gnet_stats_basic_packed bstats; |
106 | struct gnet_stats_queue qstats; | ||
107 | struct tc_htb_xstats xstats; /* our special stats */ | ||
93 | 108 | ||
94 | int prio; /* these two are used only by leaves... */ | 109 | /* token bucket parameters */ |
95 | int quantum; /* but stored for parent-to-leaf return */ | 110 | s64 tokens, ctokens;/* current number of tokens */ |
111 | s64 t_c; /* checkpoint time */ | ||
96 | 112 | ||
97 | union { | 113 | union { |
98 | struct htb_class_leaf { | 114 | struct htb_class_leaf { |
@@ -111,24 +127,12 @@ struct htb_class { | |||
111 | u32 last_ptr_id[TC_HTB_NUMPRIO]; | 127 | u32 last_ptr_id[TC_HTB_NUMPRIO]; |
112 | } inner; | 128 | } inner; |
113 | } un; | 129 | } un; |
114 | struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */ | 130 | s64 pq_key; |
115 | struct rb_node pq_node; /* node for event queue */ | ||
116 | s64 pq_key; | ||
117 | |||
118 | int prio_activity; /* for which prios are we active */ | ||
119 | enum htb_cmode cmode; /* current mode of the class */ | ||
120 | 131 | ||
121 | /* class attached filters */ | 132 | int prio_activity; /* for which prios are we active */ |
122 | struct tcf_proto *filter_list; | 133 | enum htb_cmode cmode; /* current mode of the class */ |
123 | int filter_cnt; | 134 | struct rb_node pq_node; /* node for event queue */ |
124 | 135 | struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */ | |
125 | /* token bucket parameters */ | ||
126 | struct psched_ratecfg rate; | ||
127 | struct psched_ratecfg ceil; | ||
128 | s64 buffer, cbuffer; /* token bucket depth/rate */ | ||
129 | s64 mbuffer; /* max wait time */ | ||
130 | s64 tokens, ctokens; /* current number of tokens */ | ||
131 | s64 t_c; /* checkpoint time */ | ||
132 | }; | 136 | }; |
133 | 137 | ||
134 | struct htb_sched { | 138 | struct htb_sched { |