From 46f09d5bc3f6480ce5db48b9d76f3e83299f588c Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 19 Mar 2008 06:19:01 +0000 Subject: - Relax requirements for p_numthreads, p_threads, p_swtick, and p_nice from requiring the per-process spinlock to only requiring the process lock. - Reflect these changes in the proc.h documentation and consumers throughout the kernel. This is a substantial reduction in locking cost for these fields and was made possible by recent changes to threading support. --- sys/vm/vm_meter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/vm/vm_meter.c') diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index d71eabf..c644631 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -130,13 +130,16 @@ vmtotal(SYSCTL_HANDLER_ARGS) FOREACH_PROC_IN_SYSTEM(p) { if (p->p_flag & P_SYSTEM) continue; + PROC_LOCK(p); PROC_SLOCK(p); switch (p->p_state) { case PRS_NEW: PROC_SUNLOCK(p); + PROC_UNLOCK(p); continue; break; default: + PROC_SUNLOCK(p); FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); switch (td->td_state) { @@ -164,7 +167,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) thread_unlock(td); } } - PROC_SUNLOCK(p); + PROC_UNLOCK(p); /* * Note active objects. */ -- cgit v1.1