From 4158244cc0ddfd21500ac1253f2986c7a6f36ccf Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Tue, 27 Jan 2004 20:21:07 +0000 Subject: Allow the use of a stale p_stops value in STOPEVENT(), grabbing the proc lock only if we actually need to perform a stop. This avoids two locks and unlocks of the process lock each system call, and wins me about 20% on a simply system call test (getuid(), which would otherwise require no locking). This also has a net improvement of about 10MB/s on some of the SMP bandwidth tests I'm running. Reviewed by: jhb --- sys/sys/proc.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 674d5160b486..173ce9975850 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -719,9 +719,11 @@ MALLOC_DECLARE(M_ZOMBIE); } #define STOPEVENT(p, e, v) do { \ - PROC_LOCK(p); \ - _STOPEVENT((p), (e), (v)); \ - PROC_UNLOCK(p); \ + if ((p)->p_stops & (e)) { \ + PROC_LOCK(p); \ + stopevent((p), (e), (v)); \ + PROC_UNLOCK(p); \ + } \ } while (0) #define _STOPEVENT(p, e, v) do { \ PROC_LOCK_ASSERT(p, MA_OWNED); \ -- cgit v1.3