Re: [RFC PATCH 0/4] Speed booting by sorting ORC unwind tables at build time

From: Peter Zijlstra
Date: Thu Nov 07 2019 - 10:23:11 EST


On Thu, Nov 07, 2019 at 10:32:01PM +0800, shile.zhang@xxxxxxxxxxxxxxxxx wrote:
> From: Shile Zhang <shile.zhang@xxxxxxxxxxxxxxxxx>
>
> Hi,
>
> I found the unwind_init taken long time (more than 90ms) in kernel
> booting, mainly spent on sorting the two ORC unwind tables, orc_unwind
> and orc_unwind_ip.
>
> I also noticed that this issued has reported and discussed last year:
> https://lkml.org/lkml/2018/10/8/342
> But seems no final solution until now, I tried to sort the ORC tables at
> build time, followed the helpful hints from Josh and Ingo in that thread.
> And mainly referred the implementation of 'sortextable' tool:
> https://lore.kernel.org/linux-mips/1334872799-14589-1-git-send-email-ddaney.cavm@xxxxxxxxx/
>
> What I did:
>
> - Add a Kconfig to control build-time sorting or runtime sorting;
> - Referred 'sortextable', create a similar helper tool 'sortorctable',
> help to sort the ORC unwind tables at vmlinux link process.

What is the build-time cost for doing this? The link phase is already a
fairly big bottleneck for building a kernel.

Can sort{ex,orc}table() be ran concurrently? Do they want to be the same
(threaded) tool?