zephyr/kernel
Andy Ross a04a30c6d1 kernel/sched: Move reschedule under lock in k_sched_unlock()
This function was a little clumsy, taking the scheduler lock,
releasing it, and then calling z_reschedule_unlocked() instead of the
normal locked variant of reschedule.  Don't take the lock twice.

Mostly this is a code size and hygiene win.  Obviously the sched lock
is not normally a performance path, but I happened to have picked this
API for my own microbenchmark in tests/benchmarks/swap and so noticed
the double-lock while staring at disassembly.

Signed-off-by: Andy Ross <andyross@google.com>
2026-03-10 17:24:10 +01:00
..
include kernel/sched: Add optimized next switch handle wrapper 2026-03-10 17:24:10 +01:00
paging kernel: mm: rename z_num_pagefaults_get to k_mem_num_* 2024-06-12 21:13:26 -04:00
atomic_c.c build: namespace the generated headers with zephyr/ 2024-05-28 22:03:55 +02:00
banner.c kernel: banner: Add option to clear screen on boot 2024-06-13 20:30:14 -04:00
boot_args.c kernel: boot args kconfig cleanup 2025-09-08 15:51:07 -04:00
busy_wait.c kernel: busy_wait: handle runtime system timer frequency updates 2026-02-20 13:31:07 +01:00
CMakeLists.txt arch/arm: Platform integration for new Cortex M arch_switch() 2026-03-10 17:24:10 +01:00
compiler_stack_protect.c security: Add default stack protection level 2024-12-20 12:37:20 +01:00
condvar.c kernel: Fix two k_condvar_wait() issues 2026-01-22 08:39:55 +00:00
cpu_mask.c kernel: Simplify k_thread_cpu_pin() 2024-09-20 09:02:38 +02:00
device.c device: remove duplicate code 2025-11-24 17:33:13 +01:00
dynamic.c kernel: dynamic: update storage size for pool of dynamic thread stacks 2025-10-02 11:46:22 +03:00
dynamic_disabled.c kernel: dynamic: declare dynamic stubs when disabled 2023-07-24 12:59:43 -04:00
errno.c Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00
events.c kernel: events: use abort thread timeout using dedicated function 2026-02-18 14:43:10 +00:00
fatal.c Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00
float.c build: namespace the generated headers with zephyr/ 2024-05-28 22:03:55 +02:00
futex.c kernel: futex: Allow for fast return on k_futex_wake() 2025-02-03 19:51:20 +01:00
idle.c llext: export spinlock debugging symbols to extensions 2025-02-11 10:11:31 +01:00
init.c cache: move arch_mem_coherent() into cache subsys 2025-12-09 09:25:33 +01:00
ipi.c kernel: Remove superfluous thread_is_sliceable() call 2026-01-03 10:18:53 +01:00
irq_offload.c kernel: add closing comments to config endifs 2024-03-25 18:03:31 -04:00
Kconfig kernel: drop deprecated options SCHED_DUMB and WAITQ_DUMB 2026-03-09 15:09:04 -05:00
Kconfig.device kernel: Kconfig.device: fix CONFIG_DEVICE_DEINIT_SUPPORT help text 2026-03-08 16:36:39 +01:00
Kconfig.init kernel/Kconfig.init: update description of SOC_RESET_HOOK 2025-10-07 12:50:10 +02:00
Kconfig.mem_domain kernel: mem_domain: support memory domain de-initialization 2026-02-24 10:39:59 +01:00
Kconfig.obj_core kernel: Rewrite k_pipe_* API 2025-01-17 19:43:44 +01:00
Kconfig.smp cache: move arch_mem_coherent() into cache subsys 2025-12-09 09:25:33 +01:00
Kconfig.vm arch: mmu: do not make MMU user configurable 2025-02-19 04:59:19 +01:00
kheap.c k_heap_aligned_alloc: validate the alignment argument 2025-07-19 13:45:56 -04:00
mailbox.c Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00
main_weak.c
mem_domain.c kernel: mem_domain: support memory domain de-initialization 2026-02-24 10:39:59 +01:00
mem_slab.c kernel: mem_slab: Change loop variable type 2026-03-05 04:41:02 +01:00
mempool.c kernel: mempool: use Z_HEAP_MIN_SIZE_FOR for system heap 2026-02-11 10:39:13 +01:00
mmu.c lib, kernel: use single evaluation min/max/clamp 2025-10-24 01:10:40 +03:00
msg_q.c kernel: msgq: Check possible overflow in put/get 2026-02-27 07:59:02 +01:00
mutex.c kernel: Disable k_mutex priority inheritance 2026-02-16 00:13:23 +00:00
nothread.c kernel: nothread: fix build when CONFIG_SYS_CLOCK_EXISTS=n 2026-01-13 17:27:58 +01:00
obj_core.c kernel: reduce k_spin_unlock calls using if-else if-else structure 2024-07-27 20:48:07 +03:00
pipe.c lib, kernel: use single evaluation min/max/clamp 2025-10-24 01:10:40 +03:00
poll.c kernel: poll: patch recursive lock in z_vrfy_k_poll 2026-01-08 17:32:35 -06:00
priority_queues.c kernel: priority queues: declare as static inlines 2024-04-22 16:40:11 -04:00
queue.c kernel: queue: Allow for fast return 2025-02-03 19:51:20 +01:00
sched.c kernel/sched: Move reschedule under lock in k_sched_unlock() 2026-03-10 17:24:10 +01:00
sem.c kernel: Allow for fast return on k_sem_reset() 2025-02-03 19:51:20 +01:00
smp.c kernel: mark z_smp_current_get() with the const attribute 2025-01-10 07:49:08 +01:00
spinlock_validate.c cache: move arch_mem_coherent() into cache subsys 2025-12-09 09:25:33 +01:00
stack.c Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00
sys_clock_hw_cycles.c kernel: refactor sys_clock_hw_cycles_per_sec runtime support 2026-02-20 13:31:07 +01:00
system_work_q.c kernel: workq: introduce work timeout: 2025-06-06 08:42:53 +02:00
thread.c kernel: events: wake threads atomically using waitq post-walk callback 2026-02-18 14:43:10 +00:00
thread_monitor.c kernel: thread_monitor: reafactor and remove duplicate code 2025-04-04 07:42:20 +02:00
timeout.c kernel: refactor sys_clock_hw_cycles_per_sec runtime support 2026-02-20 13:31:07 +01:00
timer.c kernel: timer: Add timer observer hooks for extensibility 2026-01-09 14:25:31 -06:00
timeslicing.c kernel: Fix race condition in z_time_slice() 2026-01-03 10:18:53 +01:00
usage.c kernel: usage: Fix CPU stats retrieval in z_sched_cpu_usage() 2025-10-22 09:04:13 +02:00
userspace.c kernel/userspace: Dynamically allocate privileged stack after user stack 2025-11-13 23:20:45 +02:00
userspace_handler.c Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00
version.c build: namespace the generated headers with zephyr/ 2024-05-28 22:03:55 +02:00
work.c cache: move arch_mem_coherent() into cache subsys 2025-12-09 09:25:33 +01:00