]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
schedlock 4/4
authorjeff <jeff@FreeBSD.org>
Sun, 15 Dec 2019 21:26:50 +0000 (21:26 +0000)
committerjeff <jeff@FreeBSD.org>
Sun, 15 Dec 2019 21:26:50 +0000 (21:26 +0000)
commit506c867c6e0e0ef3477c28e18b97f50207c7b230
treeb10f0aa09f2e058a51defcaf01c077e1f19351fa
parentde75c61fcc48045dcf7740147a06ae67af572be1
schedlock 4/4

Don't hold the scheduler lock while doing context switches.  Instead we
unlock after selecting the new thread and switch within a spinlock
section leaving interrupts and preemption disabled to prevent local
concurrency.  This means that mi_switch() is entered with the thread
locked but returns without.  This dramatically simplifies scheduler
locking because we will not hold the schedlock while spinning on
blocked lock in switch.

This change has not been made to 4BSD but in principle it would be
more straightforward.

Discussed with: markj
Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22778
18 files changed:
sys/compat/linuxkpi/common/src/linux_rcu.c
sys/dev/dpaa/bman_portals.c
sys/dev/dpaa/qman_portals.c
sys/kern/kern_intr.c
sys/kern/kern_poll.c
sys/kern/kern_switch.c
sys/kern/kern_synch.c
sys/kern/kern_thread.c
sys/kern/sched_4bsd.c
sys/kern/sched_ule.c
sys/kern/subr_epoch.c
sys/kern/subr_sleepqueue.c
sys/kern/subr_trap.c
sys/kern/subr_turnstile.c
sys/kern/vfs_bio.c
sys/mips/nlm/cms.c
sys/sys/proc.h
sys/sys/sched.h