Commit 9a620a559be65023b5fd5d0eaf37dae884c4f404
Committed by
Ralf Baechle
1 parent
52bd080d5c
Exists in
master
and in
39 other branches
MIPS, Tracing: Speed up function graph tracer
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 comparison. Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: Steven Rostedt <srostedt@redhat.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2006/ Signed-off-by: Ralf Baechle <ralf@duck.linux-mips.net>
Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff
arch/mips/kernel/ftrace.c
... | ... | @@ -200,19 +200,17 @@ |
200 | 200 | int faulted; |
201 | 201 | |
202 | 202 | /* |
203 | - * For module, move the ip from calling site of mcount to the | |
204 | - * instruction "lui v1, hi_16bit_of_mcount"(offset is 20), but for | |
205 | - * kernel, move to the instruction "move ra, at"(offset is 12) | |
203 | + * For module, move the ip from calling site of mcount after the | |
204 | + * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for | |
205 | + * kernel, move after the instruction "move ra, at"(offset is 16) | |
206 | 206 | */ |
207 | - ip = self_addr - (in_module(self_addr) ? 20 : 12); | |
207 | + ip = self_addr - (in_module(self_addr) ? 24 : 16); | |
208 | 208 | |
209 | 209 | /* |
210 | 210 | * search the text until finding the non-store instruction or "s{d,w} |
211 | 211 | * ra, offset(sp)" instruction |
212 | 212 | */ |
213 | 213 | do { |
214 | - ip -= 4; | |
215 | - | |
216 | 214 | /* get the code at "ip": code = *(unsigned int *)ip; */ |
217 | 215 | safe_load_code(code, ip, faulted); |
218 | 216 | |
... | ... | @@ -226,7 +224,9 @@ |
226 | 224 | if ((code & S_R_SP) != S_R_SP) |
227 | 225 | return parent_addr; |
228 | 226 | |
229 | - } while (((code & S_RA_SP) != S_RA_SP)); | |
227 | + /* Move to the next instruction */ | |
228 | + ip -= 4; | |
229 | + } while ((code & S_RA_SP) != S_RA_SP); | |
230 | 230 | |
231 | 231 | sp = fp + (code & OFFSET_MASK); |
232 | 232 |