Commit 11d6c461b32a3fb7e89f91ef7fa54c5446335a9c
Committed by
Jesse Gross
1 parent
e298e50570
Exists in
master
and in
16 other branches
net: ovs: use kfree_rcu instead of rcu_free_{sw_flow_mask_cb,acts_callback}
As we're only doing a kfree() anyway in the RCU callback, we can simply use kfree_rcu, which does the same job, and remove the function rcu_free_sw_flow_mask_cb() and rcu_free_acts_callback(). Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
Showing 2 changed files with 2 additions and 17 deletions Side-by-side Diff
net/openvswitch/flow_netlink.c
... | ... | @@ -1176,19 +1176,11 @@ |
1176 | 1176 | return sfa; |
1177 | 1177 | } |
1178 | 1178 | |
1179 | -/* RCU callback used by ovs_nla_free_flow_actions. */ | |
1180 | -static void rcu_free_acts_callback(struct rcu_head *rcu) | |
1181 | -{ | |
1182 | - struct sw_flow_actions *sf_acts = container_of(rcu, | |
1183 | - struct sw_flow_actions, rcu); | |
1184 | - kfree(sf_acts); | |
1185 | -} | |
1186 | - | |
1187 | 1179 | /* Schedules 'sf_acts' to be freed after the next RCU grace period. |
1188 | 1180 | * The caller must hold rcu_read_lock for this to be sensible. */ |
1189 | 1181 | void ovs_nla_free_flow_actions(struct sw_flow_actions *sf_acts) |
1190 | 1182 | { |
1191 | - call_rcu(&sf_acts->rcu, rcu_free_acts_callback); | |
1183 | + kfree_rcu(sf_acts, rcu); | |
1192 | 1184 | } |
1193 | 1185 | |
1194 | 1186 | static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa, |
net/openvswitch/flow_table.c
... | ... | @@ -155,13 +155,6 @@ |
155 | 155 | flow_free(flow); |
156 | 156 | } |
157 | 157 | |
158 | -static void rcu_free_sw_flow_mask_cb(struct rcu_head *rcu) | |
159 | -{ | |
160 | - struct sw_flow_mask *mask = container_of(rcu, struct sw_flow_mask, rcu); | |
161 | - | |
162 | - kfree(mask); | |
163 | -} | |
164 | - | |
165 | 158 | static void flow_mask_del_ref(struct sw_flow_mask *mask, bool deferred) |
166 | 159 | { |
167 | 160 | if (!mask) |
... | ... | @@ -173,7 +166,7 @@ |
173 | 166 | if (!mask->ref_count) { |
174 | 167 | list_del_rcu(&mask->list); |
175 | 168 | if (deferred) |
176 | - call_rcu(&mask->rcu, rcu_free_sw_flow_mask_cb); | |
169 | + kfree_rcu(mask, rcu); | |
177 | 170 | else |
178 | 171 | kfree(mask); |
179 | 172 | } |