All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH v4 6/7] kprobes: Use text_alloc() and text_free()
Date: Fri, 17 Jul 2020 06:04:20 +0300	[thread overview]
Message-ID: <20200717030422.679972-7-jarkko.sakkinen@linux.intel.com> (raw)
In-Reply-To: <20200717030422.679972-1-jarkko.sakkinen@linux.intel.com>

Use text_alloc() and text_free(). Those arch's that provide their
allocators will benefit from this because they can provide their custom
allocator and render out the compile time dep to the module subsystem.
Other arch's will continue to work as the fallback implementations call
module_alloc() and module_memfree().

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 kernel/kprobes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 4e46d96d4e16..f73cf71ef47d 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -40,6 +40,7 @@
 #include <asm/cacheflush.h>
 #include <asm/errno.h>
 #include <linux/uaccess.h>
+#include <linux/vmalloc.h>
 
 #define KPROBE_HASH_BITS 6
 #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS)
@@ -111,12 +112,12 @@ enum kprobe_slot_state {
 
 void __weak *alloc_insn_page(void)
 {
-	return module_alloc(PAGE_SIZE);
+	return text_alloc(PAGE_SIZE);
 }
 
 void __weak free_insn_page(void *page)
 {
-	module_memfree(page);
+	text_free(page);
 }
 
 struct kprobe_insn_cache kprobe_insn_slots = {
-- 
2.25.1


  parent reply	other threads:[~2020-07-17  3:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17  3:04 [PATCH v4 0/7] arch/x86: kprobes: Remove MODULES dependency Jarkko Sakkinen
2020-07-17  3:04 ` [PATCH v4 1/7] module: Add lock_modules() and unlock_modules() Jarkko Sakkinen
2020-07-17  3:04 ` [PATCH v4 2/7] kprobes: Use " Jarkko Sakkinen
2020-07-17  3:04 ` [PATCH v4 3/7] vmalloc: Add text_alloc() and text_free() Jarkko Sakkinen
2020-07-17  5:33   ` kernel test robot
2020-07-17  5:33     ` kernel test robot
2020-07-17  5:33   ` kernel test robot
2020-07-17  5:33     ` kernel test robot
2020-07-17  8:52   ` Masami Hiramatsu
2020-07-23 22:24     ` Jarkko Sakkinen
2020-07-18 16:23   ` Mike Rapoport
2020-07-20 12:01     ` Masami Hiramatsu
2020-07-23 22:28     ` Jarkko Sakkinen
2020-07-24 10:13       ` Mike Rapoport
2020-07-24 23:31         ` Jarkko Sakkinen
2020-07-24 23:40           ` Jarkko Sakkinen
2020-07-17  3:04 ` [PATCH v4 4/7] arch/x86: Implement " Jarkko Sakkinen
2020-07-17  3:04 ` [PATCH v4 5/7] arch/x86: kprobes: Use text_alloc() in alloc_insn_page() Jarkko Sakkinen
2020-07-23 22:16   ` Jarkko Sakkinen
2020-07-17  3:04 ` Jarkko Sakkinen [this message]
2020-07-17  3:04 ` [PATCH v4 7/7] kprobes: Flag out CONFIG_MODULES dependent code Jarkko Sakkinen

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=20200717030422.679972-7-jarkko.sakkinen@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=ak@linux.intel.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.