diff options
| author | Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> | 2016-01-22 18:11:02 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-22 20:02:18 -0500 |
| commit | 1d5cfdb076288df5eb95545a547a39905e95c930 (patch) | |
| tree | c644d2e609c3054833710b75ab1d0fe50fb17c01 /net/ipv4 | |
| parent | eab95db69d334745d3034072f4a7204084136c88 (diff) | |
tree wide: use kvfree() than conditional kfree()/vfree()
There are many locations that do
if (memory_was_allocated_by_vmalloc)
vfree(ptr);
else
kfree(ptr);
but kvfree() can handle both kmalloc()ed memory and vmalloc()ed memory
using is_vmalloc_addr(). Unless callers have special reasons, we can
replace this branch with kvfree(). Please check and reply if you found
problems.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Jan Kara <jack@suse.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Acked-by: David Rientjes <rientjes@google.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Boris Petkov <bp@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/ipv4')
| -rw-r--r-- | net/ipv4/fib_trie.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 744e5936c10d..7aea0ccb6be6 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -289,10 +289,8 @@ static void __node_free_rcu(struct rcu_head *head) | |||
| 289 | 289 | ||
| 290 | if (!n->tn_bits) | 290 | if (!n->tn_bits) |
| 291 | kmem_cache_free(trie_leaf_kmem, n); | 291 | kmem_cache_free(trie_leaf_kmem, n); |
| 292 | else if (n->tn_bits <= TNODE_KMALLOC_MAX) | ||
| 293 | kfree(n); | ||
| 294 | else | 292 | else |
| 295 | vfree(n); | 293 | kvfree(n); |
| 296 | } | 294 | } |
| 297 | 295 | ||
| 298 | #define node_free(n) call_rcu(&tn_info(n)->rcu, __node_free_rcu) | 296 | #define node_free(n) call_rcu(&tn_info(n)->rcu, __node_free_rcu) |
