linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: RFC: Allow kfree to free all types of allocations ?
Date: Tue, 09 Jun 2020 15:50:42 -0700	[thread overview]
Message-ID: <573b3fbd5927c643920e1364230c296b23e7584d.camel@perches.com> (raw)

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?



                 reply	other threads:[~2020-06-09 22:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=573b3fbd5927c643920e1364230c296b23e7584d.camel@perches.com \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).