summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-10-15 10:05:43 +0000
committermpi <mpi@openbsd.org>2019-10-15 10:05:43 +0000
commit76e7c40e8276d973d8030fe2aad05ecbf2cea0ad (patch)
tree83788e09727e0d4d208db4b4ac2f1b5013161fa5 /sys/kern/kern_fork.c
parentRewrite options_array_set to be clearer and remove a spurious warning (diff)
downloadwireguard-openbsd-76e7c40e8276d973d8030fe2aad05ecbf2cea0ad.tar.xz
wireguard-openbsd-76e7c40e8276d973d8030fe2aad05ecbf2cea0ad.zip
Reduce the number of places where `p_priority' and `p_stat' are set.
This refactoring will help future scheduler locking, in particular to shrink the SCHED_LOCK(). No intended behavior change. ok visa@
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 95180d9de31..9e8bd0aa802 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.213 2019/06/21 09:39:48 visa Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.214 2019/10/15 10:05:43 mpi Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -326,12 +326,12 @@ fork_check_maxthread(uid_t uid)
static inline void
fork_thread_start(struct proc *p, struct proc *parent, int flags)
{
+ struct cpu_info *ci;
int s;
SCHED_LOCK(s);
- p->p_stat = SRUN;
- p->p_cpu = sched_choosecpu_fork(parent, flags);
- setrunqueue(p);
+ ci = sched_choosecpu_fork(parent, flags);
+ setrunqueue(ci, p, p->p_priority);
SCHED_UNLOCK(s);
}