| To: | linux-mips@linux-mips.org, ralf@linux-mips.org |
|---|---|
| Subject: | [PATCH] MIPS: tracing/ftrace: Speedup a little for function graph tracer |
| From: | Wu Zhangjin <wuzhangjin@gmail.com> |
| Date: | Sat, 23 Oct 2010 04:57:01 +0800 |
| Cc: | David Daney <ddaney@caviumnetworks.com>, rostedt@goodmis.org, Wu Zhangjin <wuzhangjin@gmail.com> |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=fs5iWtryRhSOQ43S6rVKz57PWIq6QgxmOOAdr7QZxiQ=; b=ZmzRNd1D8NxKPBgh8rfcMXNabhVK5UtbwrMa7Cco7gkd/6ImRCxpz+cKIYZRjkfwVp R3wCAdpkmeMKP1euqUUpnzIJXC4tGCqfmG9S3S8rFaQ1IXl9di1sKQFU8r0au9Jcwov+ U0Km5LG4x4WeO0uuBsRcPiByK7LnWR0+EJzzs= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=vGh2PoASGz1BjtAxZZyk6Q+Ms1znAP1UC2xYcOS5zgBqNllYU51fWIAonKYRyOPj1v lGVvxy3SgwkIpjnnMBOKxqLeAgYg63ExsuxzXUYByJR+BvJIdNUfamithHxXdgh2HcFp XXXjKhg6WT4ci9JkglqDi3l8kU8xX5GNFtHDQ= |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| Sender: | linux-mips-bounce@linux-mips.org |
From: Wu Zhangjin <wuzhangjin@gmail.com>
This patch removes one "ip -= 4" instruction via the following change:
ip = x; ip = x - 4;
do { do {
ip -= 4; ==> foo(ip);
foo(ip); ...
... ip -= 4;
} while (y); } while (y);
BTW, the "while (( ))" is cleaned up to "while ()".
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
---
arch/mips/kernel/ftrace.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 5a84a1f..65f1949 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -200,19 +200,17 @@ unsigned long ftrace_get_parent_addr(unsigned long
self_addr,
int faulted;
/*
- * For module, move the ip from calling site of mcount to the
- * instruction "lui v1, hi_16bit_of_mcount"(offset is 20), but for
- * kernel, move to the instruction "move ra, at"(offset is 12)
+ * For module, move the ip from calling site of mcount after the
+ * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for
+ * kernel, move after the instruction "move ra, at"(offset is 16)
*/
- ip = self_addr - (in_module(self_addr) ? 20 : 12);
+ ip = self_addr - (in_module(self_addr) ? 24 : 16);
/*
* search the text until finding the non-store instruction or "s{d,w}
* ra, offset(sp)" instruction
*/
do {
- ip -= 4;
-
/* get the code at "ip": code = *(unsigned int *)ip; */
safe_load_code(code, ip, faulted);
@@ -226,7 +224,9 @@ unsigned long ftrace_get_parent_addr(unsigned long
self_addr,
if ((code & S_R_SP) != S_R_SP)
return parent_addr;
- } while (((code & S_RA_SP) != S_RA_SP));
+ /* Move to the previous instruction position */
+ ip -= 4;
+ } while ((code & S_RA_SP) != S_RA_SP);
sp = fp + (code & OFFSET_MASK);
--
1.7.1
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Is it any serial8250 platform driver available?, David Daney |
|---|---|
| Next by Date: | [RFC 0/2] Fixes the modules support of dynamic function tracer for MIPS, Wu Zhangjin |
| Previous by Thread: | Is it any serial8250 platform driver available?, Ardelean, Andrei |
| Next by Thread: | [RFC 0/2] Fixes the modules support of dynamic function tracer for MIPS, Wu Zhangjin |
| Indexes: | [Date] [Thread] [Top] [All Lists] |