jlaitine opened a new pull request, #16333:
URL: https://github.com/apache/nuttx/pull/16333

   ## Summary
   
   The critical section scope was widened before to avoid race conditions 
between signal dispatch and signal delivery,
   which were especially harmful for SMP systems (but exist also for single 
CPU).
   
   This PR makes the scope a bit smaller by removing thigs which don't need to 
be inside the critical section, to more
   appropriate places.
   
   The nxsig_find_action can be done before entering the protected section, and 
the found action can be just passed in.
   
   The memory allocations which are done as a backup if one runs out of 
preallocated pending structures can be done
   beforehand, and the dynamically allocated structures simply injected into 
the free structure lists. This has the downside
   that it may leave a dynamically allocated pending structure in the free list 
for some period of time, in case it is not needed after all. But this is not an 
issue, it is freed eventually in case it gets used.
   
   ## Impact
   
   This is unlikely to have any impact in testing, since typically the 
preallocated pending structures never run out. But this makes the critical 
section a bit smaller again by re-structuring things which are not needed to be 
in the critical section outside.
   
   In the case of really running out of pre-allocated pending structures, this 
removes a rare, but potential race condition between dispatch and delivery, if 
the dispatch leaves critical section in the middle of the logic by sleeping on 
heap mutex.
   
   ## Testing
   
   Tested on qemu rv-virt:smp, and on real HW (MPFS).
   


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