linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] ARM: kernel: module PLT optimizations
@ 2016-08-17 11:59 Ard Biesheuvel
  2016-08-17 11:59 ` [PATCH v2 1/3] ARM: kernel: merge core and init PLTs Ard Biesheuvel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2016-08-17 11:59 UTC (permalink / raw)
  To: linux-arm-kernel

As reported by Jongsung, the O(n^2) search in the PLT allocation code may
disproportionately affect module load time for modules with a larger number
of relocations.

Since the existing routines rather naively take branch instructions into
account that are internal to the module, we can improve the situation
significantly by checking the symbol section index first, and disregarding
symbols that are defined in the same module. Also, we can reduce the
algorithmic complexity to O(n log n) by sorting the reloc section before
processing it, and disregarding zero-addend relocations in the optimization.

Patch #1 merge the core and init PLTs, since the latter is virtually empty
anyway.

Patch #2 implements the optimization to only take SHN_UNDEF symbols into
account.

Patch #3 sort the reloc section, so that the duplicate check can be done by
comparing an entry with the previous one. Since REL entries (as opposed to
RELA entries) do not contain the addend, simply disregard non-zero addends
in the optimization since those are rare anyway.

v2: added patch #3

Ard Biesheuvel (3):
  ARM: kernel: merge core and init PLTs
  ARM: kernel: allocate PLT entries only for external symbols
  ARM: kernel: sort relocation sections before allocating PLTs

 arch/arm/include/asm/module.h |   6 +-
 arch/arm/kernel/module-plts.c | 208 ++++++++++++--------
 arch/arm/kernel/module.lds    |   3 +-
 3 files changed, 132 insertions(+), 85 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-17 11:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-17 11:59 [PATCH v2 0/3] ARM: kernel: module PLT optimizations Ard Biesheuvel
2016-08-17 11:59 ` [PATCH v2 1/3] ARM: kernel: merge core and init PLTs Ard Biesheuvel
2016-08-17 11:59 ` [PATCH v2 2/3] ARM: kernel: allocate PLT entries only for external symbols Ard Biesheuvel
2016-08-17 11:59 ` [PATCH v2 3/3] ARM: kernel: sort relocation sections before allocating PLTs Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).