[IA64] unwind - optimise linked-list searches for modules

It's clear from the comment in the code about keeping the
kernel's unwind table at the front of the list that some
attention has been paid to access patterns. Tests on other
architectures have shown that a move-to-front optimisation
improves searches dramatically.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
This commit is contained in:
Phil Carmody 2010-09-14 13:35:39 -07:00 committed by Tony Luck
parent 747584be04
commit 04a3440690
1 changed files with 16 additions and 1 deletions

View File

@ -1531,7 +1531,7 @@ build_script (struct unw_frame_info *info)
struct unw_labeled_state *ls, *next; struct unw_labeled_state *ls, *next;
unsigned long ip = info->ip; unsigned long ip = info->ip;
struct unw_state_record sr; struct unw_state_record sr;
struct unw_table *table; struct unw_table *table, *prev;
struct unw_reg_info *r; struct unw_reg_info *r;
struct unw_insn insn; struct unw_insn insn;
u8 *dp, *desc_end; u8 *dp, *desc_end;
@ -1560,11 +1560,26 @@ build_script (struct unw_frame_info *info)
STAT(parse_start = ia64_get_itc()); STAT(parse_start = ia64_get_itc());
prev = NULL;
for (table = unw.tables; table; table = table->next) { for (table = unw.tables; table; table = table->next) {
if (ip >= table->start && ip < table->end) { if (ip >= table->start && ip < table->end) {
/*
* Leave the kernel unwind table at the very front,
* lest moving it breaks some assumption elsewhere.
* Otherwise, move the matching table to the second
* position in the list so that traversals can benefit
* from commonality in backtrace paths.
*/
if (prev && prev != unw.tables) {
/* unw is safe - we're already spinlocked */
prev->next = table->next;
table->next = unw.tables->next;
unw.tables->next = table;
}
e = lookup(table, ip - table->segment_base); e = lookup(table, ip - table->segment_base);
break; break;
} }
prev = table;
} }
if (!e) { if (!e) {
/* no info, return default unwinder (leaf proc, no mem stack, no saved regs) */ /* no info, return default unwinder (leaf proc, no mem stack, no saved regs) */