DragonFly commits List (threaded) for 2004-03
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
cvs commit: src/sys/i386/i386 genassym.c sys_machdep.c trap.c src/sys/i386/include cpu.h src/sys/i386/isa intr_machdep.c ipl.s src/sys/kern init_main.c kern_clock.c kern_exit.c kern_fork.c kern_switch.c kern_synch.c lwkt_thread.c sys_pipe.c src/sys/sys ...
dillon 2004/03/30 11:14:18 PST
DragonFly src repository
Modified files:
sys/i386/i386 genassym.c sys_machdep.c trap.c
sys/i386/include cpu.h
sys/i386/isa intr_machdep.c ipl.s
sys/kern init_main.c kern_clock.c kern_exit.c
kern_fork.c kern_switch.c kern_synch.c
lwkt_thread.c sys_pipe.c
sys/sys globaldata.h param.h proc.h thread.h
sys/amd64/amd64 genassym.c
sys/emulation/posix4 ksched.c
Log:
Second major scheduler patch. This corrects interactive issues that were
introduced in the pipe sf_buf patch.
Split need_resched() into need_user_resched() and need_lwkt_resched().
Userland reschedules are requested when a process is scheduled with a higher
priority then the currently running process, and LWKT reschedules are
requested when a thread is scheduled with a higher priority then the
currently running thread. As before, these are ASTs, LWKTs are not
preemptively switch while running in the kernel.
Exclusively use the resched wanted flags to determine whether to reschedule
or call lwkt_switch() upon return to user mode. We were previously also
testing the LWKT run queue for higher priority threads, but this was causing
inefficient scheduler interactions when two processes are doing tightly
bound synchronous IPC (e.g. using PIPEs) because in DragonFly the LWKT
priority of a thread is raised when it enters the kernel, and lowered when
it tries to return to userland. The wakeups occuring in the pipe code
were causing extra quick-flip thread switches.
Introduce a new tsleep() flag which disables the need_lwkt_resched() call
when the sleeping thread is woken up. This is used by the PIPE code in
the synchronous direct-write PIPE case to avoid the above problem.
Redocument and revamp the ESTCPU code. The original changes reduced the
interrupt rate from 100Hz (FBsd-4 and FBsd-5) to 20Hz, but did not compensate
for the slower ramp-up time. This commit introduces a 'virtual' ESTCPU
frequency which compensates without us having to bump up the actual systimer
interrupt rate.
Redo the P_CURPROC methodology, which is used by the userland scheduler
to manage processes running in userland. Create a globaldata->gd_uschedcp
process pointer which represents the current running-in-userland (or about
to be running in userland) process, and carefully recode acquire_curproc()
to allow this gd_uschedcp designation to be stolen from other threads trying
to return to userland without having to request a reschedule (which would
have to switch back to those threads to release the designation). This
reduces the number of unnecessary context switches that occur due to
scheduler interactions. Also note that this specifically solves the case
where there might be several threads running in the kernel which are trying
to return to userland at the same time. A heuristic check against gd_upri
is used to select the correct thread for schedling to userland 'most of the
time'. When the correct thread is not selected, we fall back to the old
behavior of forcing a reschedule.
Add debugging sysctl variables to better track userland scheduler efficiency.
With these changes pipe statistics are further improved. Though some
scheduling aberrations still exist(1), the previous scheduler had totally
broken interactive processes and this one does not.
BLKSIZE BEFORE NEWPIPE NOW Tests on AMD64
MBytes/s MBytes/s MBytes/s 3200+ FN85MB
(64KB L1, 1MB L2)
256KB 1900 2200 2250
64KB 1800 2200 2250
32KB - - 3300
16KB 1650 2500-3000 2600-3200
8KB 1400 2300 2000-2400(1)
4KB 1300 1400-1500 1500-1700
Revision Changes Path
1.36 +2 -1 src/sys/i386/i386/genassym.c
1.13 +1 -1 src/sys/i386/i386/sys_machdep.c
1.48 +17 -78 src/sys/i386/i386/trap.c
1.15 +14 -6 src/sys/i386/include/cpu.h
1.21 +1 -1 src/sys/i386/isa/intr_machdep.c
1.17 +1 -0 src/sys/i386/isa/ipl.s
1.29 +3 -2 src/sys/kern/init_main.c
1.18 +1 -1 src/sys/kern/kern_clock.c
1.33 +2 -2 src/sys/kern/kern_exit.c
1.21 +3 -3 src/sys/kern/kern_fork.c
1.20 +240 -109 src/sys/kern/kern_switch.c
1.31 +39 -39 src/sys/kern/kern_synch.c
1.58 +36 -51 src/sys/kern/lwkt_thread.c
1.16 +3 -3 src/sys/kern/sys_pipe.c
1.29 +22 -15 src/sys/sys/globaldata.h
1.13 +1 -0 src/sys/sys/param.h
1.47 +10 -2 src/sys/sys/proc.h
1.49 +1 -1 src/sys/sys/thread.h
1.4 +2 -1 src/sys/amd64/amd64/genassym.c
1.4 +5 -5 src/sys/emulation/posix4/ksched.c
http://www.dragonflybsd.org/cvsweb/src/sys/i386/i386/genassym.c.diff?r1=1.35&r2=1.36&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/i386/sys_machdep.c.diff?r1=1.12&r2=1.13&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/i386/trap.c.diff?r1=1.47&r2=1.48&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/include/cpu.h.diff?r1=1.14&r2=1.15&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/isa/intr_machdep.c.diff?r1=1.20&r2=1.21&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/isa/ipl.s.diff?r1=1.16&r2=1.17&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/init_main.c.diff?r1=1.28&r2=1.29&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_clock.c.diff?r1=1.17&r2=1.18&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_exit.c.diff?r1=1.32&r2=1.33&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_fork.c.diff?r1=1.20&r2=1.21&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_switch.c.diff?r1=1.19&r2=1.20&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_synch.c.diff?r1=1.30&r2=1.31&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_thread.c.diff?r1=1.57&r2=1.58&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/sys_pipe.c.diff?r1=1.15&r2=1.16&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/sys/globaldata.h.diff?r1=1.28&r2=1.29&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/sys/param.h.diff?r1=1.12&r2=1.13&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/sys/proc.h.diff?r1=1.46&r2=1.47&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/sys/thread.h.diff?r1=1.48&r2=1.49&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/amd64/amd64/genassym.c.diff?r1=1.3&r2=1.4&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/emulation/posix4/ksched.c.diff?r1=1.3&r2=1.4&f=h
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]