From 307d87bdecde7d3fbd3af085314777e089bd7621 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 27 Mar 2016 14:30:20 +0000 Subject: [PATCH] Optimization in chSchWakeupS(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9172 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- doc/rt/reports/STM32F746-216-GCC.txt | 8 ++++---- os/rt/src/chschd.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/rt/reports/STM32F746-216-GCC.txt b/doc/rt/reports/STM32F746-216-GCC.txt index 7ef8cb302..10fd4c2a7 100644 --- a/doc/rt/reports/STM32F746-216-GCC.txt +++ b/doc/rt/reports/STM32F746-216-GCC.txt @@ -2,7 +2,7 @@ *** ChibiOS/RT test suite *** *** Kernel: 4.0.0 -*** Compiled: Mar 27 2016 - 12:48:29 +*** Compiled: Mar 27 2016 - 16:28:00 *** Compiler: GCC 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 227977] *** Architecture: ARMv7E-M *** Core Variant: Cortex-M7 @@ -93,7 +93,7 @@ --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.1 (Benchmark, messages #1) ---- Score : 1018858 msgs/S, 2037716 ctxswc/S +--- Score : 1023687 msgs/S, 2047374 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.2 (Benchmark, messages #2) @@ -105,7 +105,7 @@ --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.4 (Benchmark, context switch) ---- Score : 4951264 ctxswc/S +--- Score : 5008664 ctxswc/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.5 (Benchmark, threads, full cycle) @@ -113,7 +113,7 @@ --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.6 (Benchmark, threads, create only) ---- Score : 892556 threads/S +--- Score : 896259 threads/S --- Result: SUCCESS ---------------------------------------------------------------------------- --- Test Case 11.7 (Benchmark, mass reschedule, 5 threads) diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c index 3d7d04b58..ace722d7b 100644 --- a/os/rt/src/chschd.c +++ b/os/rt/src/chschd.c @@ -406,6 +406,7 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) { * @sclass */ void chSchWakeupS(thread_t *ntp, msg_t msg) { + thread_t *otp = currp; chDbgCheckClassS(); @@ -421,12 +422,12 @@ void chSchWakeupS(thread_t *ntp, msg_t msg) { one then it is just inserted in the ready list else it made running immediately and the invoking thread goes in the ready list instead.*/ - if (ntp->prio <= currp->prio) { + if (ntp->prio <= otp->prio) { (void) chSchReadyI(ntp); } else { - thread_t *otp = chSchReadyI(currp); currp = ntp; + otp = chSchReadyI(otp); if (otp->prio == IDLEPRIO) { CH_CFG_IDLE_LEAVE_HOOK(); }