DragonFly commits List (threaded) for 2004-03
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
cvs commit: src/sys/kern lwkt_thread.c kern_switch.c src/sys/i386/i386 trap.c swtch.s
dillon 2004/03/28 00:03:05 PST
DragonFly src repository
Modified files:
sys/kern lwkt_thread.c kern_switch.c
sys/i386/i386 trap.c swtch.s
Log:
Do some major performance tuning of the userland scheduler.
When determining whether to reschedule, use a relative priority comparison
against PPQ rather then a queue index comparison to avoid the edge case
where two processes are only a p_priority of 1 apart, but fall into
different queues. This reduces unnecessary preemptive context switches.
Also change the sense of test_resched() and document it.
Properly incriement p_ru.ru_nivcsw (involuntary context switches stat counter).
Fix uio_yield(). We have to call lwkt_setpri_self() to cycle our thread
to the end of its runq, and we do not need to call acquire_curproc() and
release_curproc() after switching.
When returning to userland, lower our priority and call lwkt_maybe_switch()
BEFORE acquiring P_CURPROC. Before we called lwkt_maybe_switch() after we
acquired P_CURPROC which could result in us holding P_CURPROC, switching to
another thread which itself returns to usermode at a higher priority, and
that thread having to switch back to us to release P_CURPROC and then us back
to the other thread again. This reduces the number of unnecessary context
switches that occur in certain situations. In particular, this cuts the
number of context switches in PIPE situations by 50-75% (1/2 to 2/3).
Revision Changes Path
1.57 +4 -0 src/sys/kern/lwkt_thread.c
1.19 +28 -15 src/sys/kern/kern_switch.c
1.47 +11 -3 src/sys/i386/i386/trap.c
1.31 +1 -1 src/sys/i386/i386/swtch.s
http://www.dragonflybsd.org/cvsweb/src/sys/kern/lwkt_thread.c.diff?r1=1.56&r2=1.57&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_switch.c.diff?r1=1.18&r2=1.19&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/i386/trap.c.diff?r1=1.46&r2=1.47&f=h
http://www.dragonflybsd.org/cvsweb/src/sys/i386/i386/swtch.s.diff?r1=1.30&r2=1.31&f=h
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]