zephyr/kernel
David Komel 211e5b73c0 kernel: k_busy_wait() should return immediately on zero timeout
When CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT is not defined, cycles_to_wait
is calculated using a division operation. This calculation could take a
significant amount of time (a few microseconds on some architectures,
depending on the system clock).
In the special case of zero usec_to_wait, the function should return
immediately rather than spend time on calculations.
For example, in spi driver (spi_context.h, _spi_context_cs_control()),
k_busy_wait() can be called with zero delay. This can increase spi
transaction time significantly.
Another improvement, is moving the start_cycles initialization
before cycles_to_wait calculation, so the time it takes to calculate
cycles_to_wait will be taken into account.

Signed-off-by: David Komel <a8961713@gmail.com>
2020-10-14 14:52:06 -04:00
..
include code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
atomic_c.c
cache_handlers.c syscalls: Add system call for cache flush & invalidate 2020-08-04 17:26:45 -04:00
CMakeLists.txt kernel: Deprecate CONFIG_MULTITHREADING 2020-09-23 15:50:32 -05:00
compiler_stack_protect.c
device.c kernel: device: invert sense of ready bit 2020-09-15 18:22:38 +02:00
errno.c
fatal.c debug/coredump: add a primitive coredump mechanism 2020-08-24 20:28:24 -04:00
futex.c
idle.c kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
init.c kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
Kconfig kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
kheap.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
mailbox.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
mem_domain.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
mem_slab.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
mempool_sys.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
mempool.c
mmu.c kernel: demote k_mem_map to z_mem_map 2020-09-03 14:24:38 -04:00
msg_q.c doc: Clarify semantics of k_msgq_put 2020-09-23 13:21:07 -05:00
mutex.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
pipes.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
poll.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
queue.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
sched.c kernel: add assert for mis-used k_thread_create() 2020-09-30 14:11:59 -04:00
sem.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
smp.c kernel: smp: avoid identifier collisions 2020-07-25 21:26:15 -04:00
stack.c kernel: stack: fix stack_push spinlock and return 2020-10-07 17:10:36 -04:00
system_work_q.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
thread_abort.c kernel: handle thread self-aborts on idle thread 2020-09-30 14:11:59 -04:00
thread.c kernel: k_busy_wait() should return immediately on zero timeout 2020-10-14 14:52:06 -04:00
timeout.c kernel: timer: update _timeout API for const correctness 2020-10-02 11:29:14 +02:00
timer.c kernel: timer: update k_timer API for const correctness 2020-10-02 11:29:14 +02:00
userspace_handler.c userspace: update k_object API to support immutable objects 2020-09-02 13:48:13 +02:00
userspace.c device: Const-ify all device driver instance pointers 2020-09-02 13:48:13 +02:00
version.c zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
work_q.c kernel: delayed_work: update k_delayed_work_cancel documentation 2020-10-09 11:48:00 +02:00