ARM: 6341/1: unwind - optimise linked-list searches for modules
authorPhil Carmody <ext-phil.2.carmody@nokia.com>
Thu, 19 Aug 2010 14:20:37 +0000 (15:20 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 2 Sep 2010 14:31:36 +0000 (15:31 +0100)
With several sections per module, and dozens of modules, the
searches down the linked list of sections would dominate the
lookup time, dwarfing any savings from the binary search
within the section.

A simple move-to-front optimisation exploits the commonality
of the code paths taken, and in simple real-world tests reduces
the number of steps in the search to barely more than 1.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/unwind.c

index dd81a918c106ea30029c0b8ce4eb60885f8a69a1..2a161765f6d5fdc0ac07805c2a4a62957adf72a0 100644 (file)
@@ -146,6 +146,8 @@ static struct unwind_idx *unwind_find_idx(unsigned long addr)
                            addr < table->end_addr) {
                                idx = search_index(addr, table->start,
                                                   table->stop - 1);
+                               /* Move-to-front to exploit common traces */
+                               list_move(&table->list, &unwind_tables);
                                break;
                        }
                }