You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/05 05:58:25 UTC

[GitHub] [incubator-nuttx] masayuki2009 commented on issue #2213: Implement the fine-grained spin lock

masayuki2009 commented on issue #2213:
URL: https://github.com/apache/incubator-nuttx/issues/2213#issuecomment-722160521


   >Right now, NuttX support one big spin lock:
   
   @xiaoxiang781216 
   NuttX has several spinlocks (e.g., g_cpu_irqlock, g_cpu_sched_lock, ... ) inside the kernel.
   
   However, yes, the current ``` spin_lock_irqsave()``` and ``` spin_unlock_irqrestore() ``` uses a global spinlock named ```g_irq_spin```. The reason why I introduced these APIs instead of multiple spinlock instance is to improve performance just by replacing some critical section APIs where we do not need to block. (e.g. just protecting register access). Also the APIs are compatible for non-SMP kernel.
   
   >the above API should rename to:
   >```
   >irqstate_t local_irq_irqsave(void);
   >void local_irqrestore(irqstate_t flags);
   >```
   
   In my understanding, these APIs are the same as the current ```up_irq_save()``` and ```up_irq_restore()``` and also these APIs do not use a spinlock while ```spin_lock_irqsave()``` and ```spin_unlock_irqrestore()``` use a spinlock. So the behaviours are different.
   
   >and add the real spinlock(multiple instance) support:
   
   I agree with you.
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org