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>
This commit is contained in:

committed by
Linus Torvalds

parent
eab95db69d
commit
1d5cfdb076
@@ -289,10 +289,8 @@ static void __node_free_rcu(struct rcu_head *head)
|
||||
|
||||
if (!n->tn_bits)
|
||||
kmem_cache_free(trie_leaf_kmem, n);
|
||||
else if (n->tn_bits <= TNODE_KMALLOC_MAX)
|
||||
kfree(n);
|
||||
else
|
||||
vfree(n);
|
||||
kvfree(n);
|
||||
}
|
||||
|
||||
#define node_free(n) call_rcu(&tn_info(n)->rcu, __node_free_rcu)
|
||||
|
Reference in New Issue
Block a user