Fix the userland scheduler. When the scheduler releases the P_CURPROC
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 16 Oct 2003 22:26:42 +0000 (22:26 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 16 Oct 2003 22:26:42 +0000 (22:26 +0000)
commit9ae9ee8d77c99531670a40a968f1ccccaf982247
tree5c134383549323278a09b7dae683443c4a70148a
parentd559ed155936148108754fe72125316a49e8835f
Fix the userland scheduler.  When the scheduler releases the P_CURPROC
designation it unconditionally handed it off to the highest priority
process on the userland process queue, ignoring the fact that the 'current'
process might have had a higher priority.  There was also a missing call to
lwkt_maybe_switch() in the resched_wanted() case that could cause interrupt
threads to stall for a long period of time when they could not preempt.

In SMP there are still some issues.  Niced processes work better, but at
the moment the P_CURPROC handoff does not take into account the fact that
the new higher priority process might better be handed off to another cpu
that is running a lower priority process then the current cpu.
sys/i386/i386/trap.c
sys/kern/kern_exit.c
sys/kern/kern_switch.c
sys/kern/kern_synch.c
sys/platform/pc32/i386/trap.c
sys/sys/proc.h
sys/sys/thread.h