[RFC,v5,0/7] Speed booting by sorting ORC unwind tables at build time
mbox series

Message ID 20191128110206.2107-1-shile.zhang@linux.alibaba.com
Headers show
Series
  • Speed booting by sorting ORC unwind tables at build time
Related show

Message

Shile Zhang Nov. 28, 2019, 11:01 a.m. UTC
This series refactored the original sortextable tools, add ORC unwind
tables sort at build time.

To sort the ORC unwind tables(.orc_unwind & .orc_unwind_ip) can save
about 100ms in my test ENV (2C4G VM w/ Xeon 2.5GHz CPU).
It costs about 30ms sort by new sorttable tool.

Any comments or suggestions are welcome!

Thanks!

Changelog:
==========
v4->v5:
- replace sort with qsort, suggested by Andy Lutomirski <luto@amacapital.net>;
- add error handling in link scripts;
- fixed some review findings;

v3->v4:
- Code refactored for Peter's review findings and suggestions.
https://lore.kernel.org/lkml/20191115164539.57930-1-shile.zhang@linux.alibaba.com/

v2->v3:
- Discard new added sortorctable tool and related Kconfig changes.
- Refactored sortextable, makes it more readable and extendable.
- Rename 'sortextable' to 'sorttable', for more kernel tables extend.
- Add ORC unwind tables sort into sorttable.
- Remove the runtime ORC tables sort.
https://lore.kernel.org/lkml/20191115064750.47888-1-shile.zhang@linux.alibaba.com/

v1->v2:
- Removed new added Kconfig and runtime sort code, advised by Josh Poimboeuf.
- Some minor refactoring.
https://lore.kernel.org/lkml/20191108071108.72132-1-shile.zhang@linux.alibaba.com/

v1:
- Added a new sortorctable tool to sort ORC unwind tables at build time,
  same as sortextable.
- Add a new Kconfigure to control if ORC unwind tables sort at build
  time.
https://lore.kernel.org/lkml/20191107143205.206606-1-shile.zhang@linux.alibaba.com/

Shile Zhang (7):
  scripts/sortextable: Rewrite error/success handling
  scripts/sortextable: kernel coding style formating
  scripts/sortextable: Remove dead code
  scripts/sortextable: refactor do_func() function
  scripts/sorttable: rename sortextable to sorttable
  scripts/sorttable: Add ORC unwind tables sort concurrently
  x86/unwind/orc: remove run-time ORC unwind tables sort

 arch/arc/Kconfig                       |   2 +-
 arch/arm/Kconfig                       |   2 +-
 arch/arm64/Kconfig                     |   2 +-
 arch/microblaze/Kconfig                |   2 +-
 arch/mips/Kconfig                      |   2 +-
 arch/parisc/Kconfig                    |   2 +-
 arch/powerpc/Kconfig                   |   2 +-
 arch/s390/Kconfig                      |   2 +-
 arch/x86/Kconfig                       |   2 +-
 arch/x86/kernel/unwind_orc.c           |   8 +-
 arch/xtensa/Kconfig                    |   2 +-
 init/Kconfig                           |   2 +-
 scripts/.gitignore                     |   2 +-
 scripts/Makefile                       |  10 +-
 scripts/link-vmlinux.sh                |  13 +-
 scripts/sortextable.h                  | 209 --------------
 scripts/{sortextable.c => sorttable.c} | 299 +++++++++----------
 scripts/sorttable.h                    | 380 +++++++++++++++++++++++++
 18 files changed, 549 insertions(+), 394 deletions(-)
 delete mode 100644 scripts/sortextable.h
 rename scripts/{sortextable.c => sorttable.c} (67%)
 create mode 100644 scripts/sorttable.h

Comments

Peter Zijlstra Dec. 2, 2019, 10:32 a.m. UTC | #1
On Thu, Nov 28, 2019 at 07:01:59PM +0800, Shile Zhang wrote:
> This series refactored the original sortextable tools, add ORC unwind
> tables sort at build time.
> 
> To sort the ORC unwind tables(.orc_unwind & .orc_unwind_ip) can save
> about 100ms in my test ENV (2C4G VM w/ Xeon 2.5GHz CPU).
> It costs about 30ms sort by new sorttable tool.

IIRC from your previous emails the new build-time sort is actually
shorter than that, so even for single build+run scenarios we win.

The code looks good to me, so:

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Who it going to apply this? I suppose we could take it through -tip,
like we do with all x86 and objtool related bits.
Ingo Molnar Dec. 2, 2019, 12:10 p.m. UTC | #2
* Peter Zijlstra <peterz@infradead.org> wrote:

> On Thu, Nov 28, 2019 at 07:01:59PM +0800, Shile Zhang wrote:
> > This series refactored the original sortextable tools, add ORC unwind
> > tables sort at build time.
> > 
> > To sort the ORC unwind tables(.orc_unwind & .orc_unwind_ip) can save
> > about 100ms in my test ENV (2C4G VM w/ Xeon 2.5GHz CPU).
> > It costs about 30ms sort by new sorttable tool.
> 
> IIRC from your previous emails the new build-time sort is actually
> shorter than that, so even for single build+run scenarios we win.
> 
> The code looks good to me, so:
> 
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> Who it going to apply this? I suppose we could take it through -tip,
> like we do with all x86 and objtool related bits.

Yeah, will apply it once the merge window slows down a bit.

Thanks,

	Ingo