Find a file
Benjamin Walsh 88b3691415 kernel/arch: enhance the "ready thread" cache
The way the ready thread cache was implemented caused it to not always
be "hot", i.e. there could be some misses, which happened when the
cached thread was taken out of the ready queue. When that happened, it
was not replaced immediately, since doing so could mean that the
replacement might not run because the flow could be interrupted and
another thread could take its place. This was the more conservative
approach that insured that moving a thread to the cache would never be
wasted.

However, this caused two problems:

1. The cache could not be refilled until another thread context-switched
in, since there was no thread in the cache to compare priorities
against.

2. Interrupt exit code would always have to call into C to find what
thread to run when the current thread was not coop and did not have the
scheduler locked. Furthermore, it was possible for this code path to
encounter a cold cache and then it had to find out what thread to run
the long way.

To fix this, filling the cache is now more aggressive, i.e. the next
thread to put in the cache is found even in the case the current cached
thread is context-switched out. This ensures the interrupt exit code is
much faster on the slow path. In addition, since finding the next thread
to run is now always "get it from the cache", which is a simple fetch
from memory (_kernel.ready_q.cache), there is no need to call the more
complex C code.

On the ARM FRDM K64F board, this improvement is seen:

Before:

1- Measure time to switch from ISR back to interrupted task

   switching time is 215 tcs = 1791 nsec

2- Measure time from ISR to executing a different task (rescheduled)

   switch time is 315 tcs = 2625 nsec

After:

1- Measure time to switch from ISR back to interrupted task

   switching time is 130 tcs = 1083 nsec

2- Measure time from ISR to executing a different task (rescheduled)

   switch time is 225 tcs = 1875 nsec

These are the most dramatic improvements, but most of the numbers
generated by the latency_measure test are improved.

Fixes ZEP-1401.

Change-Id: I2eaac147048b1ec71a93bd0a285e743a39533973
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-15 15:50:02 -05:00
.known-issues known-issues: update rule for TCF summary line 2016-09-16 11:31:27 -07:00
arch kernel/arch: enhance the "ready thread" cache 2016-12-15 15:50:02 -05:00
boards hexiwear_k64: Add pin init using ksdk pinmux driver 2016-12-10 21:14:12 +00:00
doc net: buf: Switch from k_fifo to k_lifo for free buffers 2016-12-15 12:06:22 +02:00
drivers drivers: spi: Fix the help on sys log level 2016-12-15 14:33:21 +01:00
ext power: Add ARC core suspend and resume support 2016-12-15 12:49:33 +00:00
include arm: relinquish one IRQ priority reserved by kernel 2016-12-15 15:57:10 +00:00
kernel kernel/arch: enhance the "ready thread" cache 2016-12-15 15:50:02 -05:00
lib net: buf: Remove the need for net_buf_pool_init() 2016-12-15 09:58:02 +02:00
misc printk: Export _vprintk similar to how _prf is exported 2016-12-11 04:26:05 +00:00
samples net: buf: Remove the need for net_buf_pool_init() 2016-12-15 09:58:02 +02:00
scripts scripts: remove old qemu patch 2016-12-12 20:25:06 +00:00
subsys net: multicast_eth_addr is use only with IPV6 2016-12-15 14:32:57 +00:00
tests net: remove unused variable pkt1 2016-12-15 14:33:02 +00:00
.checkpatch.conf checkpatch: ignore CONST_STRUCT warnings 2016-11-11 22:12:22 +00:00
.gitattributes First commit 2015-04-10 16:44:37 -07:00
.gitignore testcases: instruct git to ignore *log and outdir-* 2016-06-14 22:01:34 +00:00
.gitreview Add a .gitreview file 2016-02-20 14:25:01 +00:00
.mailmap mailmap: update with new emails 2016-10-07 16:15:24 +00:00
defaults.tc testcases: catch more fatal kernel error messages 2016-11-11 13:21:16 +00:00
Kbuild build: remove old kernel support 2016-11-07 11:34:18 -08:00
Kconfig kconfig: Do not put architecture in the title 2016-03-14 16:50:51 -04:00
Kconfig.zephyr usb: move usb subsystem to subsys/usb and cleanup header inclusion 2016-10-31 19:21:42 +00:00
LICENSE add top level Apache 2.0 license file 2016-02-05 20:24:37 -05:00
LICENSING.rst LICENSING: clarify licenses of imported / reused code 2016-11-11 01:36:14 +00:00
MAINTAINERS MAINTAINERS: Update network applications section 2016-12-11 19:09:25 -06:00
Makefile Merge "Merge net branch into master" 2016-12-05 15:56:26 +00:00
Makefile.inc kernel: remove NANOKERNEL and MICROKERNEL configs 2016-12-14 13:45:52 +00:00
release-notes.rst release-note: initial import with 1.6 release notes 2016-12-03 00:06:23 -05:00
zephyr-env.sh win-build: corrects scripts_path for windows build. 2016-10-15 15:09:54 +00:00