diff options
author | jeff <jeff@FreeBSD.org> | 2007-09-17 05:31:39 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2007-09-17 05:31:39 +0000 |
commit | 3fc0f8b973fdc2f392a3234d653e09d71e2aab98 (patch) | |
tree | e572a7b77f24339d2dc6ebf6b83c1e2c1ce0f6a5 /sys/kern/init_main.c | |
parent | 74666fdfce0e06484d5f82e8fced0c16c06477d1 (diff) | |
download | FreeBSD-src-3fc0f8b973fdc2f392a3234d653e09d71e2aab98.zip FreeBSD-src-3fc0f8b973fdc2f392a3234d653e09d71e2aab98.tar.gz |
- Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or
previously the sched_lock. These bugs have existed for some time.
- Allow swapout to try each thread in a process individually and then
swapin the whole process if any of these fail. This allows us to move
most scheduler related swap flags into td_flags.
- Keep ki_sflag for backwards compat but change all in source tools to
use the new and more correct location of P_INMEM.
Reported by: pho
Reviewed by: attilio, kib
Approved by: re (kensmith)
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index c0eac133..0eb26ec 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -415,8 +415,7 @@ proc0_init(void *dummy __unused) session0.s_leader = p; p->p_sysent = &null_sysvec; - p->p_flag = P_SYSTEM; - p->p_sflag = PS_INMEM; + p->p_flag = P_SYSTEM | P_INMEM; p->p_state = PRS_NORMAL; knlist_init(&p->p_klist, &p->p_mtx, NULL, NULL, NULL); STAILQ_INIT(&p->p_ktr); @@ -428,6 +427,7 @@ proc0_init(void *dummy __unused) td->td_priority = PVM; td->td_base_pri = PUSER; td->td_oncpu = 0; + td->td_flags = TDF_INMEM; p->p_peers = 0; p->p_leader = p; @@ -710,7 +710,7 @@ create_init(const void *udata __unused) /* divorce init's credentials from the kernel's */ newcred = crget(); PROC_LOCK(initproc); - initproc->p_flag |= P_SYSTEM; + initproc->p_flag |= P_SYSTEM | P_INMEM; oldcred = initproc->p_ucred; crcopy(newcred, oldcred); #ifdef MAC @@ -723,9 +723,6 @@ create_init(const void *udata __unused) PROC_UNLOCK(initproc); crfree(oldcred); cred_update_thread(FIRST_THREAD_IN_PROC(initproc)); - PROC_SLOCK(initproc); - initproc->p_sflag |= PS_INMEM; - PROC_SUNLOCK(initproc); cpu_set_fork_handler(FIRST_THREAD_IN_PROC(initproc), start_init, NULL); } SYSINIT(init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init, NULL) |