cvs commit: src/sys/ddb db_ps.c src/sys/i386/i386 trap.c vm86.c src/sys/kern init_main.c kern_clock.c kern_exit.c kern_fork.c kern_resource.c kern_sig.c kern_synch.c kern_upcall.c lwkt_thread.c usched_bsd4.c vfs_aio.c src/sys/netproto/smb ...
dillon at apollo.backplane.com
Tue Oct 11 11:16:22 PDT 2005
: 1:1 Userland threading stage 2.8/4:
: Switch the userland scheduler to use lwps instead of procs.
Nice work! A few minor issues:
We want to avoid using LIST_FIRST for this case. e.g. you are doing
p = curproc;
lp = LIST_FIRST(...)
Instead of doing that, use curthread->td_lwp (assuming its set up at that point).
Avoid using &p->p_lwp if possible, since the embedded lwp is going to go away at
some point. If this code is going to have to deal with all the LWPs then put an
XXX comment in there or do a LIST_FOREACH and/or otherwise assert that there is
only one lwp so this doesn't bite us in the ass later on.
Same problem, avoid using &p->p_lwp or add an XXX comment and an assertion that there
is only one thread.
Same issue (in several places):
Same issue. Deserves a comment at least (or maybe fork should take a proc pointer,
since you can't fork an LWP anyway).
- p = &proc0;
- error = fork1(p, RFPROC|RFMEM|RFNOWAIT, &np);
+ lp = &proc0.p_lwp;
+ error = fork1(lp, RFPROC|RFMEM|RFNOWAIT, &np);
Same issue. I think it's becoming clear that we want fork*() to take a proc pointer.
- error = fork1(&proc0, RFMEM | RFFDG | RFPROC | flags, &p2);
+ error = fork1(&proc0.p_lwp, RFMEM | RFFDG | RFPROC | flags, &p2);
- start_forked_proc(&proc0, p2);
+ start_forked_proc(&proc0.p_lwp, p2);
Same issue. Add XXX comment, KKASERT that there is only one thread if accessing
Why is this important? Even though these steps are intermediate steps and
will undergo further changes, we do not want the complexity of the work to introduce
bugs as it progresses. It is better to assert the assumed condition in the intermediate
step and take a panic later on when you've forgotten something than for the system
to become corrupt and take hours to debug.
<dillon at xxxxxxxxxxxxx>
More information about the Commits