FreeBSD/src 686bcb5 (r355784)sys/compat/linuxkpi/common/src linux_rcu.c, sys/dev/dpaa qman_portals.c bman_portals.c

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
DeltaFile
+49-80sys/kern/sched_ule.c
+15-32sys/kern/sched_4bsd.c
+7-7sys/kern/kern_synch.c
+7-7sys/kern/subr_sleepqueue.c
+7-6sys/kern/kern_intr.c
+1-9sys/compat/linuxkpi/common/src/linux_rcu.c
+1-9sys/kern/subr_epoch.c
+2-4sys/kern/kern_thread.c
+1-2sys/kern/kern_poll.c
+1-2sys/dev/dpaa/qman_portals.c
+1-2sys/dev/dpaa/bman_portals.c
+1-2sys/kern/subr_trap.c
+1-2sys/kern/subr_turnstile.c
+1-2sys/kern/vfs_bio.c
+1-2sys/mips/nlm/cms.c
+1-2sys/kern/kern_switch.c
+1-1sys/sys/proc.h
+1-1sys/sys/sched.h
+99-17218 files

UnifiedSplitRaw