patacongo commented on PR #14578:
URL: https://github.com/apache/nuttx/pull/14578#issuecomment-2501657197

   The spinlock has always been a very light weight way of waiting.  In SMP, 
sched_lock() is heavy weight and and also calls enter_critical_section which is 
even heavier.  This will effect performance.
   
   General mutual exclusion is not required.  All that is required is that the 
waiting thread no be suspended.  You should consider a redesign to keep this as 
lightweight as possible.  Consider this:
   
   - Since general mutual exclusion, is not required.  It is not necessary to 
interact with the other CPUs at all
   - A single bit of information in the TCB will do the job.
   
   If the thread is waiting for a spinlock, that bit is set and, in that case 
the thread is never suspended.  The bit is cleared after the spinlock is 
acquired.
   
   This is a very simple change, similar to sched_lock() in non-SMP mode.  And 
would return the spinlock as a simple efficient interface.  This would only 
affect the spinlock and scheduler.  With would not affect other cpus or 
releases the spinlock.
   


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