summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2019-06-01 14:11:19 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2019-06-01 14:11:19 +0000
commita0e1f7014036a5c7704503c72ab3e8adad0cfdc2 (patch)
tree98949e46f0d4ca770855c7d692b0f592dec8ad00
parent104c8c3e64f6e895292c0fad0cc732f9029b3149 (diff)
Revert to using the SCHED_LOCK() to protect time accounting.
It currently creates a lock ordering problem because SCHED_LOCK() is taken by hardclock(). That means the "priorities" of a thread should be moved out of the SCHED_LOCK() first in order to make progress. Reported-by: syzbot+8e4863b3dde88eb706dc@syzkaller.appspotmail.com via anton@ as well as by kettenis@
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_acct.c4
-rw-r--r--sys/kern/kern_exec.c4
-rw-r--r--sys/kern/kern_exit.c6
-rw-r--r--sys/kern/kern_fork.c5
-rw-r--r--sys/kern/kern_resource.c55
-rw-r--r--sys/kern/kern_sched.c6
-rw-r--r--sys/kern/kern_sysctl.c4
-rw-r--r--sys/kern/kern_time.c14
-rw-r--r--sys/kern/sched_bsd.c6
-rw-r--r--sys/kern/tty.c4
-rw-r--r--sys/sys/proc.h26
-rw-r--r--sys/sys/resourcevar.h5
-rw-r--r--sys/sys/sysctl.h12
14 files changed, 54 insertions, 101 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 0a4af1b1399..180d34cac1c 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.286 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: init_main.c,v 1.287 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -518,9 +518,7 @@ main(void *framep)
getnanotime(&pr->ps_start);
TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) {
nanouptime(&p->p_cpu->ci_schedstate.spc_runtime);
- mtx_enter(&pr->ps_mtx);
timespecclear(&p->p_rtime);
- mtx_leave(&pr->ps_mtx);
}
}
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 862f94b19a6..3bf3ae26c9a 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_acct.c,v 1.37 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_acct.c,v 1.38 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_acct.c,v 1.42 1996/02/04 02:15:12 christos Exp $ */
/*-
@@ -179,9 +179,7 @@ acct_process(struct proc *p)
memcpy(acct.ac_comm, pr->ps_comm, sizeof acct.ac_comm);
/* (2) The amount of user and system time that was used */
- mtx_enter(&pr->ps_mtx);
calctsru(&pr->ps_tu, &ut, &st, NULL);
- mtx_leave(&pr->ps_mtx);
acct.ac_utime = encode_comp_t(ut.tv_sec, ut.tv_nsec);
acct.ac_stime = encode_comp_t(st.tv_sec, st.tv_nsec);
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index b732e48a167..3019366cb1c 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.204 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.205 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -661,10 +661,8 @@ sys_execve(struct proc *p, void *v, register_t *retval)
}
/* reset CPU time usage for the thread, but not the process */
- mtx_enter(&pr->ps_mtx);
timespecclear(&p->p_tu.tu_runtime);
p->p_tu.tu_uticks = p->p_tu.tu_sticks = p->p_tu.tu_iticks = 0;
- mtx_leave(&pr->ps_mtx);
km_free(argp, NCARGS, &kv_exec, &kp_pageable);
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 1c9a522ba14..2e563668355 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.175 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.176 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -284,7 +284,7 @@ exit1(struct proc *p, int rv, int flags)
/* add thread's accumulated rusage into the process's total */
ruadd(rup, &p->p_ru);
- tuagg(p, NULL);
+ tuagg(pr, p);
/*
* clear %cpu usage during swap
@@ -296,9 +296,7 @@ exit1(struct proc *p, int rv, int flags)
* Final thread has died, so add on our children's rusage
* and calculate the total times
*/
- mtx_enter(&pr->ps_mtx);
calcru(&pr->ps_tu, &rup->ru_utime, &rup->ru_stime, NULL);
- mtx_leave(&pr->ps_mtx);
ruadd(rup, &pr->ps_cru);
/* notify interested parties of our demise and clean up */
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 4bf393afb84..190c749720e 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.211 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.212 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -55,7 +55,6 @@
#include <sys/sysctl.h>
#include <sys/pool.h>
#include <sys/mman.h>
-#include <sys/mutex.h>
#include <sys/ptrace.h>
#include <sys/atomic.h>
#include <sys/pledge.h>
@@ -211,8 +210,6 @@ process_initialize(struct process *pr, struct proc *p)
LIST_INIT(&pr->ps_kqlist);
LIST_INIT(&pr->ps_sigiolst);
- mtx_init(&pr->ps_mtx, IPL_MPFLOOR);
-
timeout_set(&pr->ps_realit_to, realitexpire, pr);
timeout_set(&pr->ps_rucheck_to, rucheck, pr);
}
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 4e972683eb7..c6982fb8c19 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_resource.c,v 1.61 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.62 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
@@ -47,13 +47,13 @@
#include <sys/ktrace.h>
#include <sys/sched.h>
#include <sys/signalvar.h>
-#include <sys/mutex.h>
+
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
-void tuagg_sub(struct tusage *, struct tusage *);
+void tuagg_sub(struct tusage *, struct proc *);
/*
* Patchable maximum data and stack limits.
@@ -338,12 +338,12 @@ sys_getrlimit(struct proc *p, void *v, register_t *retval)
}
void
-tuagg_sub(struct tusage *ttup, struct tusage *ftup)
+tuagg_sub(struct tusage *tup, struct proc *p)
{
- timespecadd(&ttup->tu_runtime, &ftup->tu_runtime, &ttup->tu_runtime);
- ttup->tu_uticks += ftup->tu_uticks;
- ttup->tu_sticks += ftup->tu_sticks;
- ttup->tu_iticks += ftup->tu_iticks;
+ timespecadd(&tup->tu_runtime, &p->p_rtime, &tup->tu_runtime);
+ tup->tu_uticks += p->p_uticks;
+ tup->tu_sticks += p->p_sticks;
+ tup->tu_iticks += p->p_iticks;
}
/*
@@ -351,26 +351,24 @@ tuagg_sub(struct tusage *ttup, struct tusage *ftup)
* totals for the thread and process
*/
void
-tuagg(struct proc *p, struct timespec *tsp)
+tuagg_unlocked(struct process *pr, struct proc *p)
{
- struct process *pr = p->p_p;
- struct tusage tu;
-
- mtx_enter(&pr->ps_mtx);
- tu.tu_uticks = p->p_uticks;
- tu.tu_sticks = p->p_sticks;
- tu.tu_iticks = p->p_iticks;
+ tuagg_sub(&pr->ps_tu, p);
+ tuagg_sub(&p->p_tu, p);
+ timespecclear(&p->p_rtime);
p->p_uticks = 0;
p->p_sticks = 0;
p->p_iticks = 0;
- if (tsp != NULL)
- timespecadd(&p->p_rtime, tsp, &p->p_rtime);
- tu.tu_runtime = p->p_rtime;
- timespecclear(&p->p_rtime);
- tuagg_sub(&pr->ps_tu, &tu);
- tuagg_sub(&p->p_tu, &tu);
- mtx_leave(&pr->ps_mtx);
+}
+void
+tuagg(struct process *pr, struct proc *p)
+{
+ int s;
+
+ SCHED_LOCK(s);
+ tuagg_unlocked(pr, p);
+ SCHED_UNLOCK(s);
}
/*
@@ -463,19 +461,15 @@ dogetrusage(struct proc *p, int who, struct rusage *rup)
/* add on all living threads */
TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) {
ruadd(rup, &q->p_ru);
- tuagg(q, NULL);
+ tuagg(pr, q);
}
- mtx_enter(&pr->ps_mtx);
calcru(&pr->ps_tu, &rup->ru_utime, &rup->ru_stime, NULL);
- mtx_leave(&pr->ps_mtx);
break;
case RUSAGE_THREAD:
*rup = p->p_ru;
- mtx_enter(&pr->ps_mtx);
calcru(&p->p_tu, &rup->ru_utime, &rup->ru_stime, NULL);
- mtx_leave(&pr->ps_mtx);
break;
case RUSAGE_CHILDREN:
@@ -513,12 +507,13 @@ rucheck(void *arg)
struct process *pr = arg;
struct rlimit *rlim;
rlim_t runtime;
+ int s;
KERNEL_ASSERT_LOCKED();
- mtx_enter(&pr->ps_mtx);
+ SCHED_LOCK(s);
runtime = pr->ps_tu.tu_runtime.tv_sec;
- mtx_leave(&pr->ps_mtx);
+ SCHED_UNLOCK(s);
rlim = &pr->ps_limit->pl_rlimit[RLIMIT_CPU];
if (runtime >= rlim->rlim_cur) {
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 346c719d13b..74920d7030f 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sched.c,v 1.57 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_sched.c,v 1.58 2019/06/01 14:11:17 mpi Exp $ */
/*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
*
@@ -212,17 +212,13 @@ void
sched_exit(struct proc *p)
{
struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
- struct process *pr = p->p_p;
struct timespec ts;
struct proc *idle;
int s;
nanouptime(&ts);
timespecsub(&ts, &spc->spc_runtime, &ts);
-
- mtx_enter(&pr->ps_mtx);
timespecadd(&p->p_rtime, &ts, &p->p_rtime);
- mtx_leave(&pr->ps_mtx);
LIST_INSERT_HEAD(&spc->spc_deadproc, p, p_hash);
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index adb4f166533..7096e861223 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.357 2019/05/31 19:51:09 mpi Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.358 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1645,9 +1645,7 @@ fill_kproc(struct process *pr, struct kinfo_proc *ki, struct proc *p,
if ((pr->ps_flags & PS_ZOMBIE) == 0) {
if ((pr->ps_flags & PS_EMBRYO) == 0 && vm != NULL)
ki->p_vm_rssize = vm_resident_count(vm);
- mtx_enter(&pr->ps_mtx);
calctsru(isthread ? &p->p_tu : &pr->ps_tu, &ut, &st, NULL);
- mtx_leave(&pr->ps_mtx);
ki->p_uutime_sec = ut.tv_sec;
ki->p_uutime_usec = ut.tv_nsec/1000;
ki->p_ustime_sec = st.tv_sec;
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 42a7fb369c5..ca109f81434 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.117 2019/05/31 19:51:10 mpi Exp $ */
+/* $OpenBSD: kern_time.c,v 1.118 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -106,7 +106,6 @@ settime(const struct timespec *ts)
int
clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp)
{
- struct process *pr = p->p_p;
struct bintime bt;
struct proc *q;
int error = 0;
@@ -127,18 +126,14 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp)
case CLOCK_PROCESS_CPUTIME_ID:
nanouptime(tp);
timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp);
- mtx_enter(&pr->ps_mtx);
- timespecadd(tp, &pr->ps_tu.tu_runtime, tp);
+ timespecadd(tp, &p->p_p->ps_tu.tu_runtime, tp);
timespecadd(tp, &p->p_rtime, tp);
- mtx_leave(&pr->ps_mtx);
break;
case CLOCK_THREAD_CPUTIME_ID:
nanouptime(tp);
timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp);
- mtx_enter(&pr->ps_mtx);
timespecadd(tp, &p->p_tu.tu_runtime, tp);
timespecadd(tp, &p->p_rtime, tp);
- mtx_leave(&pr->ps_mtx);
break;
default:
/* check for clock from pthread_getcpuclockid() */
@@ -147,11 +142,8 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp)
q = tfind(__CLOCK_PTID(clock_id) - THREAD_PID_OFFSET);
if (q == NULL || q->p_p != p->p_p)
error = ESRCH;
- else {
- mtx_enter(&pr->ps_mtx);
+ else
*tp = q->p_tu.tu_runtime;
- mtx_leave(&pr->ps_mtx);
- }
KERNEL_UNLOCK();
} else
error = EINVAL;
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 1cb5c91ce38..63e0b59f697 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.52 2019/05/31 19:51:10 mpi Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.53 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -343,6 +343,7 @@ mi_switch(void)
struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
struct proc *p = curproc;
struct proc *nextproc;
+ struct process *pr = p->p_p;
struct timespec ts;
#ifdef MULTIPROCESSOR
int hold_count;
@@ -380,10 +381,11 @@ mi_switch(void)
#endif
} else {
timespecsub(&ts, &spc->spc_runtime, &ts);
+ timespecadd(&p->p_rtime, &ts, &p->p_rtime);
}
/* add the time counts for this thread to the process's total */
- tuagg(p, &ts);
+ tuagg_unlocked(pr, p);
/*
* Process is about to yield the CPU; clear the appropriate
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 5c4366e66a5..e4ad73ddd3d 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.145 2019/05/31 19:51:10 mpi Exp $ */
+/* $OpenBSD: tty.c,v 1.146 2019/06/01 14:11:17 mpi Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -2191,9 +2191,7 @@ update_pickpr:
rss = (pickpr->ps_flags & (PS_EMBRYO | PS_ZOMBIE)) ? 0 :
vm_resident_count(pickpr->ps_vmspace);
- mtx_enter(&pickpr->ps_mtx);
calctsru(&pickpr->ps_tu, &utime, &stime, NULL);
- mtx_leave(&pickpr->ps_mtx);
/* Round up and print user time. */
utime.tv_nsec += 5000000;
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index dd2ea7c45cc..a0bd65cd578 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.266 2019/05/31 19:51:10 mpi Exp $ */
+/* $OpenBSD: proc.h,v 1.267 2019/06/01 14:11:18 mpi Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -154,11 +154,6 @@ RBT_HEAD(unvname_rbt, unvname);
struct futex;
LIST_HEAD(futex_list, futex);
struct unveil;
-
-/*
- * Locks used to protect struct members in this file:
- * m this process' `ps_mtx'
- */
struct process {
/*
* ps_mainproc is the original thread in the process.
@@ -186,7 +181,6 @@ struct process {
struct futex_list ps_ftlist; /* futexes attached to this process */
LIST_HEAD(, kqueue) ps_kqlist; /* kqueues attached to this process */
- struct mutex ps_mtx; /* per-process mutex */
/* The following fields are all zeroed upon creation in process_new. */
#define ps_startzero ps_klist
@@ -206,7 +200,7 @@ struct process {
struct ptrace_state *ps_ptstat;/* Ptrace state */
struct rusage *ps_ru; /* sum of stats for dead threads. */
- struct tusage ps_tu; /* [m] accumulated times. */
+ struct tusage ps_tu; /* accumulated times. */
struct rusage ps_cru; /* sum of stats for reaped children */
struct itimerval ps_timer[3]; /* timers, indexed by ITIMER_* */
struct timeout ps_rucheck_to; /* resource limit check timer */
@@ -307,14 +301,12 @@ struct lock_list_entry;
/*
* Locks used to protect struct members in this file:
* s scheduler lock
- * I immutable after creation
- * pm parent process `ps_mtx'
*/
struct proc {
TAILQ_ENTRY(proc) p_runq; /* [s] current run/sleep queue */
LIST_ENTRY(proc) p_list; /* List of all threads. */
- struct process *p_p; /* [I] The process of this thread. */
+ struct process *p_p; /* The process of this thread. */
TAILQ_ENTRY(proc) p_thr_link; /* Threads in a process linkage. */
TAILQ_ENTRY(proc) p_fut_link; /* Threads in a futex linkage. */
@@ -345,17 +337,17 @@ struct proc {
int p_cpticks; /* Ticks of cpu time. */
const volatile void *p_wchan; /* [s] Sleep address. */
struct timeout p_sleep_to;/* timeout for tsleep() */
- struct cpu_info * volatile p_cpu; /* [s] CPU we're running on. */
const char *p_wmesg; /* [s] Reason for sleep. */
fixpt_t p_pctcpu; /* [s] %cpu for this thread */
u_int p_slptime; /* [s] Time since last blocked. */
- u_int p_uticks; /* [pm] Statclock hits in user mode */
- u_int p_sticks; /* [pm] Statclock hits in system mode */
- u_int p_iticks; /* [pm] Statclock hits in intr. */
+ u_int p_uticks; /* Statclock hits in user mode. */
+ u_int p_sticks; /* Statclock hits in system mode. */
+ u_int p_iticks; /* Statclock hits processing intr. */
+ struct cpu_info * volatile p_cpu; /* [s] CPU we're running on. */
struct rusage p_ru; /* Statistics */
- struct tusage p_tu; /* [pm] accumulated times. */
- struct timespec p_rtime; /* [pm] Real time. */
+ struct tusage p_tu; /* accumulated times. */
+ struct timespec p_rtime; /* Real time. */
int p_siglist; /* Signals arrived but not delivered. */
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h
index 5a74fa715dc..bffde74a0e5 100644
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: resourcevar.h,v 1.21 2019/05/31 19:51:10 mpi Exp $ */
+/* $OpenBSD: resourcevar.h,v 1.22 2019/06/01 14:11:18 mpi Exp $ */
/* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */
/*
@@ -58,7 +58,8 @@ do { \
#ifdef _KERNEL
void addupc_intr(struct proc *, u_long);
void addupc_task(struct proc *, u_long, u_int);
-void tuagg(struct proc *, struct timespec *);
+void tuagg_unlocked(struct process *, struct proc *);
+void tuagg(struct process *, struct proc *);
struct tusage;
void calctsru(struct tusage *, struct timespec *, struct timespec *,
struct timespec *);
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index b7c87ce9a71..d75be8c8658 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.187 2019/05/31 19:51:10 mpi Exp $ */
+/* $OpenBSD: sysctl.h,v 1.188 2019/06/01 14:11:18 mpi Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -536,14 +536,6 @@ struct kinfo_vmentry {
* p_tpgid, p_tsess, p_vm_rssize, p_u[us]time_{sec,usec}, p_cpuid
*/
-#if defined(_KERNEL)
-#define PR_LOCK(pr) mtx_enter(&(pr)->ps_mtx)
-#define PR_UNLOCK(pr) mtx_leave(&(pr)->ps_mtx)
-#else
-#define PR_LOCK(pr) /* nothing */
-#define PR_UNLOCK(pr) /* nothing */
-#endif
-
#define PTRTOINT64(_x) ((u_int64_t)(u_long)(_x))
#define FILL_KPROC(kp, copy_str, p, pr, uc, pg, paddr, \
@@ -582,7 +574,6 @@ do { \
(kp)->p_jobc = (pg)->pg_jobc; \
\
(kp)->p_estcpu = (p)->p_estcpu; \
- PR_LOCK(pr); \
if (isthread) { \
(kp)->p_rtime_sec = (p)->p_tu.tu_runtime.tv_sec; \
(kp)->p_rtime_usec = (p)->p_tu.tu_runtime.tv_nsec/1000; \
@@ -598,7 +589,6 @@ do { \
(kp)->p_sticks = (pr)->ps_tu.tu_sticks; \
(kp)->p_iticks = (pr)->ps_tu.tu_iticks; \
} \
- PR_UNLOCK(pr); \
(kp)->p_cpticks = (p)->p_cpticks; \
\
if (show_addresses) \