RFC: Allow kfree to free all types of allocations ?

From: Joe Perches
Date: Tue Jun 09 2020 - 18:50:48 EST


There are a lot of patches trying to match
various [kv].alloc allocations to specific frees.

But are there frees in a fast path?

Why not convert kfree to add a few extra tests
and add #defines for existing uses

Something like:

void kfree(const void *addr)
{
if (is_kernel_rodata((unsigned long)addr))
return;

if (is_vmalloc_addr(addr))
_vfree(addr);
else
_kfree(addr);
}

And add defines like:

#define kvfree kfree
#define vfree kfree
#define kfree_const kfree

Does 4 extra tests really matter?