linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: Allow kfree to free all types of allocations ?
@ 2020-06-09 22:50 Joe Perches
  0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2020-06-09 22:50 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LKML

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?



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-09 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 22:50 RFC: Allow kfree to free all types of allocations ? Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).