cvs commit: src/sys/kern init_main.c kern_synch.c src/sys/sys globaldata.h param.h proc.h thread2.h
Matthew Dillon
dillon at crater.dragonflybsd.org
Tue Nov 8 12:51:51 PST 2005
dillon 2005/11/08 12:47:02 PST
DragonFly src repository
Modified files:
sys/kern init_main.c kern_synch.c
sys/sys globaldata.h param.h proc.h thread2.h
Log:
Make tsleep/wakeup MP SAFE part 1/2.
Make most of the tsleep/wakeup core code MP safe. Convert the global sleep
id hash table to a per-cpu hash table and use cpu-localization for all access
to the hash table. Note that the timeout code is also per-cpu and will
issue the timeout callback on the correct cpu.
On an SMP box, this code is actually more efficient then the old code.
Instead of having to send multiple IPI messages by calling lwkt_schedule()
on each foreign thread, we now send one IPI message to the target cpu and
lwkt_schedule() is localized only for matching threads on that cpu.
wakeup_one() continues to be supported. We pass a flag and chain through
the cpus until we exhaust available cpus or locate a match. Currently we
do not round-robin the cpu mask check, so this could use some improvement.
A global cpumask array has been added so only cpus possibly containing
the sleeping threads are chained. We chain the IPI rather then broadcast
it to reduce latency on the originating wakeup() and to introduce a
staggered wakeup between cpus that may reduce resource collisions when
multiple threads are blocked on the same resource.
This code uses the same cpu-localization concepts that much of the rest of
DragonFly uses for SMP, which means no mutexes, no locks, and virtually no
added overhead in the same-cpu case, and a simple asynchronous send-and-forget
IPI message for the SMP case.
Revision Changes Path
1.50 +1 -5 src/sys/kern/init_main.c
1.51 +169 -25 src/sys/kern/kern_synch.c
1.40 +4 -0 src/sys/sys/globaldata.h
1.29 +4 -0 src/sys/sys/param.h
1.71 +1 -1 src/sys/sys/proc.h
1.25 +4 -4 src/sys/sys/thread2.h
http://www.dragonflybsd.org/cvsweb/src/sys/kern/init_main.c.diff?r1=1.49&r2=1.50&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_synch.c.diff?r1=1.50&r2=1.51&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/globaldata.h.diff?r1=1.39&r2=1.40&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/param.h.diff?r1=1.28&r2=1.29&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/proc.h.diff?r1=1.70&r2=1.71&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/thread2.h.diff?r1=1.24&r2=1.25&f=u
More information about the Commits
mailing list