Commit 210260594782ba9bc52732d84880573466c13441
Committed by
Antonio Quartulli
1 parent
d7ee88d048
batman-adv: don't use call_rcu if not needed
batadv_tt_global_entry_free_ref uses call_rcu to schedule a function which will only free the global entry itself. For this reason call_rcu is useless and kfree_rcu can be used to simplify the code. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Showing 1 changed file with 6 additions and 14 deletions Side-by-side Diff
net/batman-adv/translation-table.c
... | ... | @@ -117,25 +117,17 @@ |
117 | 117 | kfree_rcu(tt_local_entry, common.rcu); |
118 | 118 | } |
119 | 119 | |
120 | -static void batadv_tt_global_entry_free_rcu(struct rcu_head *rcu) | |
121 | -{ | |
122 | - struct batadv_tt_common_entry *tt_common_entry; | |
123 | - struct batadv_tt_global_entry *tt_global_entry; | |
124 | - | |
125 | - tt_common_entry = container_of(rcu, struct batadv_tt_common_entry, rcu); | |
126 | - tt_global_entry = container_of(tt_common_entry, | |
127 | - struct batadv_tt_global_entry, common); | |
128 | - | |
129 | - kfree(tt_global_entry); | |
130 | -} | |
131 | - | |
120 | +/** | |
121 | + * batadv_tt_global_entry_free_ref - decrement the refcounter for a | |
122 | + * tt_global_entry and possibly free it | |
123 | + * @tt_global_entry: the object to free | |
124 | + */ | |
132 | 125 | static void |
133 | 126 | batadv_tt_global_entry_free_ref(struct batadv_tt_global_entry *tt_global_entry) |
134 | 127 | { |
135 | 128 | if (atomic_dec_and_test(&tt_global_entry->common.refcount)) { |
136 | 129 | batadv_tt_global_del_orig_list(tt_global_entry); |
137 | - call_rcu(&tt_global_entry->common.rcu, | |
138 | - batadv_tt_global_entry_free_rcu); | |
130 | + kfree_rcu(tt_global_entry, common.rcu); | |
139 | 131 | } |
140 | 132 | } |
141 | 133 |