jlaitine opened a new pull request, #16360: URL: https://github.com/apache/nuttx/pull/16360
## Summary This PR completes the semaphore "fast path" in libc, by enabling the fast path also for counting semaphores, when they have the priority inheritance disabled. This is beneficial for the performance especially in SMP and memory protected builds, in cases where the signalling semaphore is used as a counter. For example a "multiple writer <-> single reader" queue, where a lower priority reader sleeps on a semaphore when the queue is empty, and several high-speed writers post to the queue. As long as the semaphore value remains >= 0, the operations reduce to simple atomic increase/decrease without need for a syscall to kernel, or aquire the big kernel lock in SMP system. This optimization opportunity was discussed in https://github.com/apache/nuttx/pull/16194#issuecomment-2853322370 . ## Impact This boosts the signalling semaphore performance, but how much depends a lot on the use case. This has neglible effect on image size: decreases the image size by 42 bytes is 32-bit builds with CONFIG_PRIORITY_INHERITANCE=n and increases the image size by 56 bytes with CONFIG_PRIORITY_INHERITANCE=y (measured from rv-virt:smp target). ## Testing Tested on real applications on real HW: IMX93, CONFIG_BUILD_FLAT and CONFIG_BUILD_KERNEL, CONFIG_PRIORITY_INHERITANCE=y MPFS with SMP 4 cores, CONFIG_BUILD_FLAT and CONFIG_BUILD_KERNEL, CONFIG_PRIORITY_INHERITANCE=y Tested with ostest with real HW: MPFS with SMP 4 cores, CONFIG_BUILD_FLAT, CONFIG_PRIORITY_INHERITANCE=y Tested with osteset on virtual HW: rv-virt:smp , CONFIG_PRIORITY_INHERITANCE=n rv-virt:smp , CONFIG_PRIORITY_INHERITANCE=y -- 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: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org