anchao commented on PR #15705:
URL: https://github.com/apache/nuttx/pull/15705#issuecomment-2621399977

   > > 4. sched/spinlock: removed the semantics of disable preemption from 
default spin_lock
   > > 
   > > In the RTOS environment, spin_lock is simplified as much as possible to 
improve performance. At the same time, we provide an set of APIs that disable 
preemption by default:
   > > ```
   > > spin_lock                ->      spin_lock_nopreempt
   > > spin_trylock             ->      spin_trylock_nopreempt
   > > spin_unlock              ->      spin_unlock_nopreempt
   > > spin_lock_irqsave        ->      spin_lock_irqsave_nopreempt
   > > spin_trylock_irqsave     ->      spin_trylock_irqsave_nopreempt
   > > spin_unlock_irqrestore   ->      spin_unlock_irqrestore_nopreempt
   > > ```
   > 
   > spinlock need hold sched lock in no-RT case.
   
   why? If no scheduling occurs in the spin_lock protected code, why do we need 
to hold the sched_lock?
   In addition, I provide the spin_lock_nopreempt() version, you should use 
this one not spin_lock()
   
   
   > 
   > > This also has the same intention with RT-Linux.
   > 
   > No, RT-Linux map spinlock to mutex.
   
   After merge this patch, you can make changes from spin_lock to mutex. This 
PR just removes sched_lock to improve performance.


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

Reply via email to