Commit 59a7a298 authored by Masami Hiramatsu (Google)'s avatar Masami Hiramatsu (Google) Committed by Steven Rostedt (Google)

fprobe: Add nr_maxactive to specify rethook_node pool size

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'.

Link: https://lkml.kernel.org/r/167526697917.433354.17779774988245113106.stgit@mhiramat.roam.corp.google.com

Cc: Florent Revest <revest@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 34cabf8f
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
* @flags: The status flag. * @flags: The status flag.
* @rethook: The rethook data structure. (internal data) * @rethook: The rethook data structure. (internal data)
* @entry_data_size: The private data storage size. * @entry_data_size: The private data storage size.
* @nr_maxactive: The max number of active functions.
* @entry_handler: The callback function for function entry. * @entry_handler: The callback function for function entry.
* @exit_handler: The callback function for function exit. * @exit_handler: The callback function for function exit.
*/ */
...@@ -31,6 +32,7 @@ struct fprobe { ...@@ -31,6 +32,7 @@ struct fprobe {
unsigned int flags; unsigned int flags;
struct rethook *rethook; struct rethook *rethook;
size_t entry_data_size; size_t entry_data_size;
int nr_maxactive;
void (*entry_handler)(struct fprobe *fp, unsigned long entry_ip, void (*entry_handler)(struct fprobe *fp, unsigned long entry_ip,
struct pt_regs *regs, void *entry_data); struct pt_regs *regs, void *entry_data);
......
...@@ -143,7 +143,10 @@ static int fprobe_init_rethook(struct fprobe *fp, int num) ...@@ -143,7 +143,10 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
} }
/* Initialize rethook if needed */ /* 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) if (size < 0)
return -E2BIG; return -E2BIG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment