All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: linux-trace-kernel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	mhiramat@kernel.org, Florent Revest <revest@chromium.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Will Deacon <will@kernel.org>
Subject: [PATCH v2 03/10] fprobe: Add nr_maxactive to specify rethook_node pool size
Date: Wed,  1 Feb 2023 01:15:30 +0900	[thread overview]
Message-ID: <167518173031.336834.3343880383483990761.stgit@mhiramat.roam.corp.google.com> (raw)
In-Reply-To: <167518170369.336834.15310137713178284219.stgit@mhiramat.roam.corp.google.com>

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Add nr_maxactive to specify rethook_node pool size. This means
the maximum number of actively running target functions concurrently
for probing by exit_handler. Note that if the running function is
preempted or sleep, it is still counted as 'active'.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 include/linux/fprobe.h |    2 ++
 kernel/trace/fprobe.c  |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/fprobe.h b/include/linux/fprobe.h
index e0d4e6136249..678f741a7b33 100644
--- a/include/linux/fprobe.h
+++ b/include/linux/fprobe.h
@@ -14,6 +14,7 @@
  * @flags: The status flag.
  * @rethook: The rethook data structure. (internal data)
  * @entry_data_size: The private data storage size.
+ * @nr_maxactive: The max number of active functions.
  * @entry_handler: The callback function for function entry.
  * @exit_handler: The callback function for function exit.
  */
@@ -31,6 +32,7 @@ struct fprobe {
 	unsigned int		flags;
 	struct rethook		*rethook;
 	size_t			entry_data_size;
+	int			nr_maxactive;
 
 	void (*entry_handler)(struct fprobe *fp, unsigned long entry_ip,
 			      struct pt_regs *regs, void *entry_data);
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index fa25d09c9d57..f222848571f2 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -143,7 +143,10 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
 	}
 
 	/* Initialize rethook if needed */
-	size = num * num_possible_cpus() * 2;
+	if (fp->nr_maxactive)
+		size = fp->nr_maxactive;
+	else
+		size = num * num_possible_cpus() * 2;
 	if (size < 0)
 		return -E2BIG;
 


  parent reply	other threads:[~2023-01-31 16:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 16:15 [PATCH v2 00/10] tracing: Add fprobe events Masami Hiramatsu (Google)
2023-01-31 16:15 ` [PATCH v2 01/10] fprobe: Pass entry_data to handlers Masami Hiramatsu (Google)
2023-01-31 16:15 ` [PATCH v2 02/10] lib/test_fprobe: Add private entry_data testcases Masami Hiramatsu (Google)
2023-01-31 16:15 ` Masami Hiramatsu (Google) [this message]
2023-01-31 16:15 ` [PATCH v2 04/10] lib/test_fprobe: Add a test case for nr_maxactive Masami Hiramatsu (Google)
2023-01-31 16:15 ` [PATCH v2 05/10] fprobe: Skip exit_handler if entry_handler returns !0 Masami Hiramatsu (Google)
2023-01-31 16:15 ` [PATCH v2 06/10] lib/test_fprobe: Add a testcase for skipping exit_handler Masami Hiramatsu (Google)
2023-01-31 16:16 ` [PATCH v2 07/10] docs: tracing: Update fprobe documentation Masami Hiramatsu (Google)
2023-01-31 16:16 ` [PATCH v2 08/10] fprobe: Pass return address to the handlers Masami Hiramatsu (Google)
2023-01-31 16:16 ` [PATCH v2 09/10] tracing/probes: Add fprobe events for tracing function entry and exit Masami Hiramatsu (Google)
2023-02-01  7:27   ` kernel test robot
2023-02-01 12:42     ` Masami Hiramatsu
2023-01-31 16:16 ` [PATCH v2 10/10] selftests/ftrace: Add fprobe related testcases Masami Hiramatsu (Google)

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=167518173031.336834.3343880383483990761.stgit@mhiramat.roam.corp.google.com \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=revest@chromium.org \
    --cc=rostedt@goodmis.org \
    --cc=will@kernel.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 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.