public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] kprobe-booster: boosting multi-probe
@ 2006-02-17  9:06 Masami Hiramatsu
  2006-02-17  9:51 ` Prasanna S Panchamukhi
  0 siblings, 1 reply; 9+ messages in thread
From: Masami Hiramatsu @ 2006-02-17  9:06 UTC (permalink / raw)
  To: systemtap, Prasanna S Panchamukhi, Ananth N Mavinakayanahalli,
	Keshavamurthy, Anil S, Jim Keniston
  Cc: Satoshi Oshima, Yumiko Sugita, Hideo Aoki, Maneesh Soni

Hi,

I developed a patch to enhance boost-ability of multi-probes.
Please review it.

Currently, the boosting process of a kprobe is disabled by
inserting another probe to the same address.
This will be occurred easily, because both of a kprobe and
a kretprobe are inserted to the top of a function when a
SystemTap user would like to measure the processing time
of that function.

One of the reasons of this degradation is the aggregator kprobe
always registers four kind of handlers(pre_handler, post_handler,
break_handler and fault_handler) even if aggregated probes do NOT
have post_handlers and break_handler. The boosted kprobe can
NOT have post_handler and break_handler, because boosting process
skips post processing of probing to accelerate process.
Also, the break_handler is special handler. The execution path of
break_handler skips boosting routine. So, currently the probe that
has break_handler is not boosted.

Multi-probe booster
===================
- Boosting the probes which are inserted to the same address as
  far as those do not have post_handler and break_handler.
- Set post_handler and break_handler of the aggregator probe to
  NULL if the aggregated probe does not have post_handler and
  break_handler.


This patch is elementary against linux-2.6.16-rc2-mm1.
Before applying this patch, you must apply the patch posted by
Mao Bibo which can be accessed from following URL:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=2294#c3

-- 
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp

 kprobes.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
diff -Narup a/kernel/kprobes.c b/kernel/kprobes.c
--- a/kernel/kprobes.c	2006-02-15 10:48:32.000000000 +0900
+++ b/kernel/kprobes.c	2006-02-16 16:56:12.000000000 +0900
@@ -370,6 +370,11 @@ static int __kprobes add_new_kprobe(stru
 {
         struct kprobe *kp;

+	if (p->post_handler || p->break_handler) { /* For more boostability */
+		old_p->post_handler = aggr_post_handler;
+		old_p->break_handler = aggr_break_handler;
+	}
+
 	if (p->break_handler) {
 		list_for_each_entry_rcu(kp, &old_p->list, list) {
 			if (kp->break_handler)
@@ -390,16 +395,30 @@ static inline void add_aggr_kprobe(struc
 	copy_kprobe(p, ap);
 	ap->addr = p->addr;
 	ap->pre_handler = aggr_pre_handler;
-	ap->post_handler = aggr_post_handler;
 	ap->fault_handler = aggr_fault_handler;
-	ap->break_handler = aggr_break_handler;
-
+	if (p->post_handler || p->break_handler) { /* For more boostability */
+		ap->post_handler = aggr_post_handler;
+		ap->break_handler = aggr_break_handler;
+	}
 	INIT_LIST_HEAD(&ap->list);
 	list_add_rcu(&p->list, &ap->list);

 	hlist_replace_rcu(&p->hlist, &ap->hlist);
 }

+static inline void boost_aggr_kprobe(struct kprobe *ap)
+{
+        struct kprobe *kp;
+	if (ap->post_handler || ap->break_handler) {
+		list_for_each_entry_rcu(kp, &ap->list, list) {
+			if (kp->post_handler || kp->break_handler)
+				return;
+		}
+	}
+	ap->post_handler = NULL;
+	ap->break_handler = NULL;
+}
+
 /*
  * This is the second or subsequent kprobe at the address - handle
  * the intricacies
@@ -536,6 +555,8 @@ valid_p:
 			kfree(old_p);
 		}
 		arch_remove_kprobe(p);
+	} else {
+		boost_aggr_kprobe(old_p);
 	}
 }



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-04-26  9:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-17  9:06 [PATCH] kprobe-booster: boosting multi-probe Masami Hiramatsu
2006-02-17  9:51 ` Prasanna S Panchamukhi
2006-02-17 12:31   ` Masami Hiramatsu
2006-03-13  6:39     ` bibo,mao
2006-03-13 13:51       ` Masami Hiramatsu
2006-03-14  2:16         ` bibo,mao
2006-03-15 13:38           ` Masami Hiramatsu
2006-04-26  7:51           ` Masami Hiramatsu
2006-04-26  9:33             ` bibo,mao

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 read-only IMAP folder(s) and NNTP newsgroup(s).