diff options
| author | Thadeu Lima de Souza Cascardo <cascardo@redhat.com> | 2016-09-15 18:11:52 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-09-18 22:14:01 -0400 |
| commit | 40773966ccf1985a1b2bb570a03cbeaf1cbd4e00 (patch) | |
| tree | f94c6d8663b6e6131e6c06fde5849b719e7d3e2a /net/openvswitch | |
| parent | 829ff34868075ad57822783718de64acff4df303 (diff) | |
openvswitch: fix flow stats accounting when node 0 is not possible
On a system with only node 1 as possible, all statistics is going to be
accounted on node 0 as it will have a single writer.
However, when getting and clearing the statistics, node 0 is not going
to be considered, as it's not a possible node.
Tested that statistics are not zero on a system with only node 1
possible. Also compile-tested with CONFIG_NUMA off.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
| -rw-r--r-- | net/openvswitch/flow.c | 6 | ||||
| -rw-r--r-- | net/openvswitch/flow_table.c | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 1240ae3b88d2..5b80612df182 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
| @@ -142,7 +142,8 @@ void ovs_flow_stats_get(const struct sw_flow *flow, | |||
| 142 | *tcp_flags = 0; | 142 | *tcp_flags = 0; |
| 143 | memset(ovs_stats, 0, sizeof(*ovs_stats)); | 143 | memset(ovs_stats, 0, sizeof(*ovs_stats)); |
| 144 | 144 | ||
| 145 | for_each_node(node) { | 145 | /* We open code this to make sure node 0 is always considered */ |
| 146 | for (node = 0; node < MAX_NUMNODES; node = next_node(node, node_possible_map)) { | ||
| 146 | struct flow_stats *stats = rcu_dereference_ovsl(flow->stats[node]); | 147 | struct flow_stats *stats = rcu_dereference_ovsl(flow->stats[node]); |
| 147 | 148 | ||
| 148 | if (stats) { | 149 | if (stats) { |
| @@ -165,7 +166,8 @@ void ovs_flow_stats_clear(struct sw_flow *flow) | |||
| 165 | { | 166 | { |
| 166 | int node; | 167 | int node; |
| 167 | 168 | ||
| 168 | for_each_node(node) { | 169 | /* We open code this to make sure node 0 is always considered */ |
| 170 | for (node = 0; node < MAX_NUMNODES; node = next_node(node, node_possible_map)) { | ||
| 169 | struct flow_stats *stats = ovsl_dereference(flow->stats[node]); | 171 | struct flow_stats *stats = ovsl_dereference(flow->stats[node]); |
| 170 | 172 | ||
| 171 | if (stats) { | 173 | if (stats) { |
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index d073fff82fdb..957a3c31dbb0 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c | |||
| @@ -148,8 +148,9 @@ static void flow_free(struct sw_flow *flow) | |||
| 148 | kfree(flow->id.unmasked_key); | 148 | kfree(flow->id.unmasked_key); |
| 149 | if (flow->sf_acts) | 149 | if (flow->sf_acts) |
| 150 | ovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts); | 150 | ovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts); |
| 151 | for_each_node(node) | 151 | /* We open code this to make sure node 0 is always considered */ |
| 152 | if (flow->stats[node]) | 152 | for (node = 0; node < MAX_NUMNODES; node = next_node(node, node_possible_map)) |
| 153 | if (node != 0 && flow->stats[node]) | ||
| 153 | kmem_cache_free(flow_stats_cache, | 154 | kmem_cache_free(flow_stats_cache, |
| 154 | (struct flow_stats __force *)flow->stats[node]); | 155 | (struct flow_stats __force *)flow->stats[node]); |
| 155 | kmem_cache_free(flow_cache, flow); | 156 | kmem_cache_free(flow_cache, flow); |
