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

   ## Summary
   
   The page allocator takes the granule lock once per page: `fork()` copies a 
process one page at a time, and destroying an address environment frees it one 
page at a time. With SMP and a semaphore, unlock gives the lock to a waiter 
that is only made ready; when all CPUs run tasks of the same priority, that 
waiter can wait a full round-robin interval for a CPU while it holds the lock, 
and every page allocation waits behind it.
   
   On qemu-armv8a with 4 CPUs and 4 shells that run programs in a loop, the 
LPWORK thread took up to 631 ms to destroy an address environment (1 ms when 
idle), the freed pages fell behind, and the page pool ran empty. With 
`GRAN_INTR` the destroy took 2 ms and the pool stayed full.
   
   This PR makes `GRAN_INTR` the default for `MM_PGALLOC` with SMP.
   
   ## Impact
   
   Changes the default for SMP configurations with `MM_PGALLOC`: their page 
allocator uses a spinlock instead of a semaphore. Configurations can still turn 
it off. In the tree that is 8 defconfigs: `sabre-6quad:knsh_smp`, 
`sabre-6quad:netknsh_smp`, `qemu-armv7a:knsh_smp`, `eic7700-evb:nsh`, 
`starpro64:nsh`, `rv-virt:knetnsh64_smp`, `rv-virt:ksmp64`, 
`qemu-intel64:nxterm`. None of them sets `GRAN_INTR` today, so their 
`savedefconfig` output does not change.
   
   ## Testing
   
   Builds: `qemu-armv8a:nsh`, `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`.
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   
   The measurements in the summary were made on `qemu-armv8a:knsh` with 4 CPUs.
   


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