login
Header Space

 
 

[PATCH -mm 2/5] kprobes: add (un)register_kprobes for batch registration

Previous thread: Re: Keys get stuck by Bodo Eggert on Friday, March 14, 2008 - 4:20 pm. (1 message)

Next thread: [PATCH -mm 1/5] list.h: add list_singleton by Masami Hiramatsu on Friday, March 14, 2008 - 4:40 pm. (7 messages)
To: Andrew Morton <akpm@...>
Cc: Ananth N Mavinakayanahalli <ananth@...>, Jim Keniston <jkenisto@...>, Prasanna S Panchamukhi <prasanna@...>, Shaohua Li <shaohua.li@...>, LKML <linux-kernel@...>, systemtap-ml <systemtap@...>, David Miller <davem@...>, Frank Ch. Eigler <fche@...>
Date: Friday, March 14, 2008 - 4:40 pm

Introduce unregister_/register_kprobes() for kprobe batch
registration. This can reduce waiting time for
synchronized_sched() when a lot of probes have to be
unregistered at once.

Signed-off-by: Masami Hiramatsu &lt;mhiramat@redhat.com&gt;
---
I rewrote a patchset which had been discussed on LKML,
and simplified its interfaces.
 http://lkml.org/lkml/2007/3/23/181

 include/linux/kprobes.h |    9 +++
 kernel/kprobes.c        |  124 +++++++++++++++++++++++++++++++++---------------
 2 files changed, 96 insertions(+), 37 deletions(-)

Index: 2.6.25-rc5-mm1/include/linux/kprobes.h
===================================================================
--- 2.6.25-rc5-mm1.orig/include/linux/kprobes.h
+++ 2.6.25-rc5-mm1/include/linux/kprobes.h
@@ -234,6 +234,8 @@ static inline struct kprobe_ctlblk *get_

 int register_kprobe(struct kprobe *p);
 void unregister_kprobe(struct kprobe *p);
+int register_kprobes(struct kprobe **kps, int num);
+void unregister_kprobes(struct kprobe **kps, int num);
 int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
 int longjmp_break_handler(struct kprobe *, struct pt_regs *);
 int register_jprobe(struct jprobe *p);
@@ -261,9 +263,16 @@ static inline int register_kprobe(struct
 {
 	return -ENOSYS;
 }
+static inline int register_kprobes(struct kprobe **kps, int num)
+{
+	return -ENOSYS;
+}
 static inline void unregister_kprobe(struct kprobe *p)
 {
 }
+static inline void unregister_kprobes(struct kprobe **kps, int num)
+{
+}
 static inline int register_jprobe(struct jprobe *p)
 {
 	return -ENOSYS;
Index: 2.6.25-rc5-mm1/kernel/kprobes.c
===================================================================
--- 2.6.25-rc5-mm1.orig/kernel/kprobes.c
+++ 2.6.25-rc5-mm1/kernel/kprobes.c
@@ -580,6 +580,7 @@ static int __kprobes __register_kprobe(s
 	}

 	p-&gt;nmissed = 0;
+	INIT_LIST_HEAD(&amp;p-&gt;list);
 	mutex_lock(&amp;kprobe_mutex);
 	old_p = get_kprobe(p-&gt;addr);
 	if (old_p) {
@@ -606,35 +607,28 @@ out:
 	return ret;
 }

-int __...
Previous thread: Re: Keys get stuck by Bodo Eggert on Friday, March 14, 2008 - 4:20 pm. (1 message)

Next thread: [PATCH -mm 1/5] list.h: add list_singleton by Masami Hiramatsu on Friday, March 14, 2008 - 4:40 pm. (7 messages)
speck-geostationary