Skip to content

Commit 04a3440

Browse files
Phil Carmodyaegl
authored andcommitted
[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 <[email protected]> Signed-off-by: Tony Luck <[email protected]>
1 parent 747584b commit 04a3440

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

arch/ia64/kernel/unwind.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ build_script (struct unw_frame_info *info)
15311531
struct unw_labeled_state *ls, *next;
15321532
unsigned long ip = info->ip;
15331533
struct unw_state_record sr;
1534-
struct unw_table *table;
1534+
struct unw_table *table, *prev;
15351535
struct unw_reg_info *r;
15361536
struct unw_insn insn;
15371537
u8 *dp, *desc_end;
@@ -1560,11 +1560,26 @@ build_script (struct unw_frame_info *info)
15601560

15611561
STAT(parse_start = ia64_get_itc());
15621562

1563+
prev = NULL;
15631564
for (table = unw.tables; table; table = table->next) {
15641565
if (ip >= table->start && ip < table->end) {
1566+
/*
1567+
* Leave the kernel unwind table at the very front,
1568+
* lest moving it breaks some assumption elsewhere.
1569+
* Otherwise, move the matching table to the second
1570+
* position in the list so that traversals can benefit
1571+
* from commonality in backtrace paths.
1572+
*/
1573+
if (prev && prev != unw.tables) {
1574+
/* unw is safe - we're already spinlocked */
1575+
prev->next = table->next;
1576+
table->next = unw.tables->next;
1577+
unw.tables->next = table;
1578+
}
15651579
e = lookup(table, ip - table->segment_base);
15661580
break;
15671581
}
1582+
prev = table;
15681583
}
15691584
if (!e) {
15701585
/* no info, return default unwinder (leaf proc, no mem stack, no saved regs) */

0 commit comments

Comments
 (0)