pussuw commented on code in PR #16194: URL: https://github.com/apache/nuttx/pull/16194#discussion_r2056201724
########## include/nuttx/semaphore.h: ########## @@ -184,9 +184,17 @@ int nxsem_destroy(FAR sem_t *sem); * ****************************************************************************/ -int nxsem_wait(FAR sem_t *sem); int nxsem_wait_slow(FAR sem_t *sem); +#if !defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT) +static inline int nxsem_wait(FAR sem_t *sem) Review Comment: Doesn't this just depend on how contested the semaphores are ? For code size, it depends if the chip can do atomic_try_cmpxchg_acquire without locking with a single atomic instruction. The locking adds extra **inline** code, this is why the code size increases so dramatically for stm32f3 and in this case, taking the slow path directly should also be faster. I'm wondering if it's possible to use __atomic_always_lock_free somehow to enable/disable the fast paths? If not, then the fast path must be possible to disable in some other way. -- 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