summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_fork.c19
-rw-r--r--sys/kern/kern_kthread.c7
-rw-r--r--sys/kern/kern_physio.c4
-rw-r--r--sys/kern/kern_synch.c14
-rw-r--r--sys/kern/kern_sysctl.c10
-rw-r--r--sys/kern/sched_bsd.c11
-rw-r--r--sys/kern/sys_process.c19
8 files changed, 21 insertions, 67 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 3ebb901b5cc..5e69f2e3748 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.131 2006/11/14 18:00:27 jmc Exp $ */
+/* $OpenBSD: init_main.c,v 1.132 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -273,7 +273,7 @@ main(void *framep)
p->p_thrparent = p;
LIST_INIT(&p->p_thrchildren);
- p->p_flag = P_INMEM | P_SYSTEM | P_NOCLDWAIT;
+ p->p_flag = P_SYSTEM | P_NOCLDWAIT;
p->p_stat = SONPROC;
p->p_nice = NZERO;
p->p_emul = &emul_native;
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index a68f5b09815..3c8d6f3c011 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.84 2006/04/30 15:37:07 kettenis Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.85 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -191,10 +191,7 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
return (EAGAIN);
}
- /*
- * Allocate a pcb and kernel stack for the process
- */
- uaddr = uvm_km_valloc_align(kernel_map, USPACE, USPACE_ALIGN);
+ uaddr = uvm_km_alloc1(kernel_map, USPACE, USPACE_ALIGN, 1);
if (uaddr == 0) {
chgproccnt(uid, -1);
nprocs--;
@@ -237,7 +234,7 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
* Increase reference counts on shared objects.
* The p_stats and p_sigacts substructs are set in vm_fork.
*/
- p2->p_flag = P_INMEM;
+ p2->p_flag = 0;
p2->p_emul = p1->p_emul;
if (p1->p_flag & P_PROFIL)
startprofclock(p2);
@@ -331,11 +328,6 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
*/
if (p2->p_emul->e_proc_fork)
(*p2->p_emul->e_proc_fork)(p2, p1);
- /*
- * This begins the section where we must prevent the parent
- * from being swapped.
- */
- PHOLD(p1);
p2->p_addr = (struct user *)uaddr;
@@ -407,11 +399,6 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
SCHED_UNLOCK(s);
/*
- * Now can be swapped.
- */
- PRELE(p1);
-
- /*
* Notify any interested parties about the new process.
*/
KNOTE(&p1->p_klist, NOTE_FORK | p2->p_pid);
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 7f8e60b7141..e60176d611d 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_kthread.c,v 1.25 2005/12/03 18:09:08 tedu Exp $ */
+/* $OpenBSD: kern_kthread.c,v 1.26 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */
/*-
@@ -81,10 +81,9 @@ kthread_create(void (*func)(void *), void *arg,
return (error);
/*
- * Mark it as a system process and not a candidate for
- * swapping.
+ * Mark it as a system process.
*/
- p2->p_flag |= P_INMEM | P_SYSTEM; /* XXX */
+ p2->p_flag |= P_SYSTEM;
/* Name it as specified. */
va_start(ap, fmt);
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 436436be615..a6489286910 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_physio.c,v 1.25 2006/11/15 17:25:40 jmc Exp $ */
+/* $OpenBSD: kern_physio.c,v 1.26 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: kern_physio.c,v 1.28 1997/05/19 10:43:28 pk Exp $ */
/*-
@@ -157,7 +157,6 @@ physio(void (*strategy)(struct buf *), struct buf *bp, dev_t dev, int flags,
* saves it in b_saveaddr. However, vunmapbuf()
* restores it.
*/
- PHOLD(p);
error = uvm_vslock(p, bp->b_data, todo,
(flags & B_READ) ?
VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ);
@@ -198,7 +197,6 @@ physio(void (*strategy)(struct buf *), struct buf *bp, dev_t dev, int flags,
vunmapbuf(bp, todo);
uvm_vsunlock(p, bp->b_data, todo);
after_unlock:
- PRELE(p);
/* remember error value (save a splbio/splx pair) */
if (bp->b_flags & B_ERROR)
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 83ddbe84d60..ae237fb2c92 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.74 2006/10/21 02:18:00 tedu Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.75 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -336,17 +336,13 @@ restart:
* XXXSMP See affinity comment in
* resched_proc().
*/
- if ((p->p_flag & P_INMEM) != 0) {
- setrunqueue(p);
+ setrunqueue(p);
#ifdef __HAVE_CPUINFO
- KASSERT(p->p_cpu != NULL);
- need_resched(p->p_cpu);
+ KASSERT(p->p_cpu != NULL);
+ need_resched(p->p_cpu);
#else
- need_resched(NULL);
+ need_resched(NULL);
#endif
- } else {
- wakeup(&proc0);
- }
/* END INLINE EXPANSION */
if (n != 0)
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 343fdf1c15f..d6085b8c3f4 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.142 2006/05/28 19:41:42 dlg Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.143 2006/11/29 12:24:17 miod Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1159,14 +1159,12 @@ fill_eproc(struct proc *p, struct eproc *ep)
} else {
struct vmspace *vm = p->p_vmspace;
- PHOLD(p); /* need for pstats */
ep->e_vm.vm_rssize = vm_resident_count(vm);
ep->e_vm.vm_tsize = vm->vm_tsize;
ep->e_vm.vm_dsize = vm->vm_dused;
ep->e_vm.vm_ssize = vm->vm_ssize;
ep->e_pstats = *p->p_stats;
ep->e_pstats_valid = 1;
- PRELE(p);
}
if (p->p_pptr)
ep->e_ppid = p->p_pptr->p_pid;
@@ -1220,7 +1218,7 @@ fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
ki->p_eflag = 0;
ki->p_exitsig = p->p_exitsig;
- ki->p_flag = p->p_flag;
+ ki->p_flag = p->p_flag | P_INMEM;
ki->p_pid = p->p_pid;
if (p->p_pptr)
@@ -1308,7 +1306,7 @@ fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
#else
ki->p_schedflags = p->p_schedflags;
#endif
- ki->p_holdcnt = p->p_holdcnt;
+ ki->p_holdcnt = 1;
ki->p_priority = p->p_priority;
ki->p_usrpri = p->p_usrpri;
if (p->p_wmesg)
@@ -1330,7 +1328,6 @@ fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
} else {
ki->p_uvalid = 1;
- PHOLD(p); /* need for pstats */
ki->p_ustart_sec = p->p_stats->p_start.tv_sec;
ki->p_ustart_usec = p->p_stats->p_start.tv_usec;
@@ -1364,7 +1361,6 @@ fill_kproc2(struct proc *p, struct kinfo_proc2 *ki)
if (p->p_cpu != NULL)
ki->p_cpuid = CPU_INFO_UNIT(p->p_cpu);
#endif
- PRELE(p);
}
}
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 45c76eb7a3a..a62c5248b86 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.8 2006/11/15 17:25:40 jmc Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.9 2006/11/29 12:24:18 miod Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -310,7 +310,6 @@ schedcpu(void *arg)
if (p->p_priority >= PUSER) {
if ((p != curproc) &&
p->p_stat == SRUN &&
- (p->p_flag & P_INMEM) &&
(p->p_priority / PPQ) != (p->p_usrpri / PPQ)) {
remrunqueue(p);
p->p_priority = p->p_usrpri;
@@ -618,15 +617,11 @@ setrunnable(struct proc *p)
break;
}
p->p_stat = SRUN;
- if (p->p_flag & P_INMEM)
- setrunqueue(p);
+ setrunqueue(p);
if (p->p_slptime > 1)
updatepri(p);
p->p_slptime = 0;
- if ((p->p_flag & P_INMEM) == 0)
- wakeup(&proc0);
- else
- resched_proc(p, p->p_priority);
+ resched_proc(p, p->p_priority);
}
/*
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 55554087a5a..e60ff8b7ef7 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.36 2006/07/19 18:38:42 grunk Exp $ */
+/* $OpenBSD: sys_process.c,v 1.37 2006/11/29 12:24:18 miod Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -322,7 +322,6 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
if (SCARG(uap, data) < 0 || SCARG(uap, data) >= NSIG)
return (EINVAL);
- PHOLD(t);
/* If the address parameter is not (int *)1, set the pc. */
if ((int *)SCARG(uap, addr) != (int *)1)
if ((error = process_set_pc(t, SCARG(uap, addr))) != 0)
@@ -336,7 +335,6 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
if (error)
goto relebad;
#endif
- PRELE(t);
goto sendsig;
case PT_DETACH:
@@ -356,7 +354,6 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
if (SCARG(uap, data) < 0 || SCARG(uap, data) >= NSIG)
return (EINVAL);
- PHOLD(t);
#ifdef PT_STEP
/*
* Arrange for a single-step, if that's requested and possible.
@@ -365,7 +362,6 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
if (error)
goto relebad;
#endif
- PRELE(t);
/* give process back to original parent or init */
if (t->p_oppid != t->p_pptr->p_pid) {
@@ -395,7 +391,6 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
return (0);
relebad:
- PRELE(t);
return (error);
case PT_KILL:
@@ -451,9 +446,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
regs = malloc(sizeof(*regs), M_TEMP, M_WAITOK);
error = copyin(SCARG(uap, addr), regs, sizeof(*regs));
if (error == 0) {
- PHOLD(p);
error = process_write_regs(t, regs);
- PRELE(p);
}
free(regs, M_TEMP);
return (error);
@@ -463,9 +456,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
return (error);
regs = malloc(sizeof(*regs), M_TEMP, M_WAITOK);
- PHOLD(p);
error = process_read_regs(t, regs);
- PRELE(p);
if (error == 0)
error = copyout(regs,
SCARG(uap, addr), sizeof (*regs));
@@ -480,9 +471,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
fpregs = malloc(sizeof(*fpregs), M_TEMP, M_WAITOK);
error = copyin(SCARG(uap, addr), fpregs, sizeof(*fpregs));
if (error == 0) {
- PHOLD(p);
error = process_write_fpregs(t, fpregs);
- PRELE(p);
}
free(fpregs, M_TEMP);
return (error);
@@ -494,9 +483,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
return (error);
fpregs = malloc(sizeof(*fpregs), M_TEMP, M_WAITOK);
- PHOLD(p);
error = process_read_fpregs(t, fpregs);
- PRELE(p);
if (error == 0)
error = copyout(fpregs,
SCARG(uap, addr), sizeof(*fpregs));
@@ -512,9 +499,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
xmmregs = malloc(sizeof(*xmmregs), M_TEMP, M_WAITOK);
error = copyin(SCARG(uap, addr), xmmregs, sizeof(*xmmregs));
if (error == 0) {
- PHOLD(p);
error = process_write_xmmregs(t, xmmregs);
- PRELE(p);
}
free(xmmregs, M_TEMP);
return (error);
@@ -526,9 +511,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
return (error);
xmmregs = malloc(sizeof(*xmmregs), M_TEMP, M_WAITOK);
- PHOLD(p);
error = process_read_xmmregs(t, xmmregs);
- PRELE(p);
if (error == 0)
error = copyout(xmmregs,
SCARG(uap, addr), sizeof(*xmmregs));