casaroli opened a new pull request, #20555:
URL: https://github.com/apache/nuttx/pull/20555

   ## Summary
   
   `libelf_relocateadd()` keeps a cache of `CONFIG_LIBC_ELF_SYMBOL_CACHECOUNT` 
symbols in a list and reads each missing symbol from the file with its own 
read. A large module has many more relocations than symbols, and most of its 
load time is spent in these small reads. A module with 1.1 million relocations 
against 82000 symbols took more than 30 minutes to load from a 9P share.
   
   If there is memory for it, this PR reads the whole symbol table in one read 
and resolves each symbol only once. Otherwise it uses the cache as before.
   
   ## Impact
   
   Relocatable ELF loading with RELA relocations. It uses `sh_size` of the 
symbol table plus one byte per symbol of heap during the relocation of each 
section, and falls back to the old path when that allocation fails. The results 
are the same.
   
   ## Testing
   
   `qemu-armv8a:knsh` with `CONFIG_DRIVERS_VIRTIO`, 
`CONFIG_DRIVERS_VIRTIO_MMIO`, `CONFIG_FS_V9FS` and `CONFIG_V9FS_VIRTIO_9P`, 
QEMU 11 (`-m 512M`, a `virtio-9p-device` share). The test programs were built 
outside the tree against the export package.
   
   A generated program with 20000 global functions, each calling three others 
(60000 relocations against 20000 symbols), loaded from the host file system:
   
   ```
   nsh> time bigsym
   ```
   
   Before: 0.4821 sec. After: 0.2596 sec.
   
   The difference is larger when each read is slow. A 66 MB program with 1.1 
million relocations, loaded from a 9P share, did not finish loading in 30 
minutes before; after, a run of it that includes the load takes about 30 
seconds.
   
   It needs #20554, which frees flash in `lm3s6965-ek:qemu-flat`: this change 
alone overflows it by 8 bytes.
   
   depends-on: apache/nuttx/pull/20554
   


-- 
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]

Reply via email to