All of lore.kernel.org
 help / color / mirror / Atom feed
From: wu zhangjin <wuzhangjin@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Wu Zhangjin <wuzhangjin@gmail.com>,
	Steven Rostedt <srostedt@redhat.com>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH 1/5] tracing, MIPS: reduce one instruction for function graph tracer
Date: Thu, 20 Jan 2011 03:30:32 +0800	[thread overview]
Message-ID: <AANLkTinuP0ZDVgWQiG-YyCV1LWRAYMZB2dtQhHW6DOqE@mail.gmail.com> (raw)
In-Reply-To: <5fcf37ab006f1ccfe6844e7392a66c4cdd1aa84d.1295464564.git.wuzhangjin@gmail.com>

Sorry, please ignore this one.

On Thu, Jan 20, 2011 at 3:28 AM, Wu Zhangjin <wuzhangjin@gmail.com> wrote:
> This simply moves the "ip-=4" statement down to the end of the do { ...
> } while (...); loop, which reduces one unneeded subtration and the
> subsequent memory loading and comparation. as a result, speed up the
> function a little.
>
> 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..635c1dc 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 next instruction */
> +               ip -= 4;
> +       } while ((code & S_RA_SP) != S_RA_SP);
>
>        sp = fp + (code & OFFSET_MASK);
>
> --
> 1.7.1
>
>

  reply	other threads:[~2011-01-19 19:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 19:28 [PATCH 0/5] Misc updates for Ftrace of MIPS Wu Zhangjin
2011-01-19 19:28 ` [PATCH 1/5] tracing, MIPS: Speed up function graph tracer Wu Zhangjin
2011-01-24 13:50   ` Ralf Baechle
     [not found] ` <cover.1295464564.git.wuzhangjin@gmail.com>
2011-01-19 19:28   ` [PATCH 1/5] tracing, MIPS: reduce one instruction for " Wu Zhangjin
2011-01-19 19:30     ` wu zhangjin [this message]
2011-01-19 19:28   ` [PATCH 2/5] tracing, MIPS: replace in_module() with a generic in_kernel_space() Wu Zhangjin
2011-01-19 19:30     ` wu zhangjin
2011-01-19 19:28 ` [PATCH 2/5] tracing, MIPS: Substitute in_kernel_space() for in_module() Wu Zhangjin
2011-01-24 13:57   ` Ralf Baechle
2011-01-26 12:36     ` wu zhangjin
2011-01-19 19:28 ` [PATCH 3/5] tracing, MIPS: Clean up prepare_ftrace_return() Wu Zhangjin
2011-01-24 14:21   ` Ralf Baechle
2011-01-19 19:28 ` [PATCH 4/5] tracing, MIPS: Clean up ftrace_make_nop() Wu Zhangjin
2011-01-19 19:28 ` [PATCH 5/5] tracing, MIPS: Fix set_graph_function of function graph tracer Wu Zhangjin
2011-01-20 11:03   ` Sergei Shtylyov
2011-01-20 12:46     ` wu zhangjin
2011-01-20 14:04     ` Steven Rostedt
2011-01-21  9:09       ` wu zhangjin

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=AANLkTinuP0ZDVgWQiG-YyCV1LWRAYMZB2dtQhHW6DOqE@mail.gmail.com \
    --to=wuzhangjin@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=srostedt@redhat.com \
    /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.