anchao opened a new pull request #5645:
URL: https://github.com/apache/incubator-nuttx/pull/5645


   
   
   ## Summary
   
   arch/arm: optimize context switch speed
   
   The current context save implementation saves registers of each task
   to xcp context, which is unnecessary because most of the arm registers are
   already saved in the task stack, this commit replace the xcp context with
   stack context to improve context switching performance and reduce the tcb
   space occupation of tcb instance.
   
   Signed-off-by: chao.an <anc...@xiaomi.com>
   
   ## Impact
   
   arm context switch
   
   ## Testing
   
   Qemu:
      sabre-6quad/smp,  sabre-6quad/netknsh 
   
   Cortex-m33: cycle count test
   
   `#define DWT_CYCCNT                   (DWT_BASE + 0x0004)  /* Cycle Count 
Register */`
   
   **thread 1: (priority 100)**
   ```
   start = getreg32(DWT_CYCCNT);
   sem_post(&g_exclsem);
   ```
   
   **thread 2: (priority 200)**
   ```
   sem_wait(&g_exclsem);
   end = getreg32(DWT_CYCCNT);
   ```
   
   Before:
   `semaphore wait test:     797`
   After:
   `semaphore wait test:     604`   + ~24%


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