casaroli opened a new pull request, #20601: URL: https://github.com/apache/nuttx/pull/20601
## Summary `libelf_findsymbol()` read every symbol and then its name with separate file reads. binfmt calls it on every exec for `nx_stacksize` and `nx_priority` (and for `nx_uid`, `nx_gid` and `nx_mode` with `SCHED_USER_IDENTITY`), and most programs define none of them, so each call read the whole table. For a program with 5700 symbols that is about 23000 reads per exec. This PR reads the symbol table and the string table into memory once and compares the names there. If there is no memory for them, it reads one symbol at a time as before. ## Impact Faster exec of ELF programs, mostly on slow file systems. The loader allocates the two tables for the time of the search. ## Testing The run-time tests ran on a local branch that has this change and other pending changes on top of master; the builds are of this branch alone. qemu-armv8a, kernel build, QEMU 11 with HVF on Apple M4, programs on a virtio 9P share. An exec of a program with 5700 symbols took 1.2 s before and 44 ms after (10 execs in 437 ms). Builds with `-Wno-cpp -Werror`: `qemu-armv8a:knsh`, `mps2-an500:nsh`, `rv-virt:knsh64`. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
