summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-01-24 11:06:39 +0000
committerjhb <jhb@FreeBSD.org>2001-01-24 11:06:39 +0000
commitdaef77c52d385b35fa60ce96930df20c3af9d0ab (patch)
tree7cea75ae6f7335026fa1ed499f6416ad961ee49e /sys
parentbd862d8954b7c73febfa6c179a9d9930af7b2c7b (diff)
downloadFreeBSD-src-daef77c52d385b35fa60ce96930df20c3af9d0ab.zip
FreeBSD-src-daef77c52d385b35fa60ce96930df20c3af9d0ab.tar.gz
- Add a mtx_assert() for sched_lock in calcru().
- Protect calcru() with sched_lock later on in the file when it is called.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_resource.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index e67ee79..e29c273 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -513,6 +513,7 @@ calcru(p, up, sp, ip)
int s;
struct timeval tv;
+ mtx_assert(&sched_lock, MA_OWNED);
/* XXX: why spl-protect ? worst case is an off-by-one report */
s = splstatclock();
ut = p->p_uticks;
@@ -609,7 +610,9 @@ getrusage(p, uap)
case RUSAGE_SELF:
rup = &p->p_stats->p_ru;
+ mtx_enter(&sched_lock, MTX_SPIN);
calcru(p, &rup->ru_utime, &rup->ru_stime, NULL);
+ mtx_exit(&sched_lock, MTX_SPIN);
break;
case RUSAGE_CHILDREN:
OpenPOWER on IntegriCloud