From 8b64fa1e120d0c6c1935ac745c5beb3132259131 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Wed, 26 Aug 2015 03:37:18 +0000 Subject: [PATCH] Avoid taking proctree_lock and searching parents in wrappers if not needed. This should help the case where filemon is loaded but not in use. Sponsored by: EMC / Isilon Storage Division MFC after: 2 weeks --- sys/dev/filemon/filemon_wrapper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/filemon/filemon_wrapper.c b/sys/dev/filemon/filemon_wrapper.c index e162cf58bb2..d107a40892f 100644 --- a/sys/dev/filemon/filemon_wrapper.c +++ b/sys/dev/filemon/filemon_wrapper.c @@ -88,6 +88,10 @@ filemon_pid_check(struct proc *p) struct filemon *filemon; filemon_lock_read(); + if (TAILQ_EMPTY(&filemons_inuse)) { + filemon_unlock_read(); + return (NULL); + } sx_slock(&proctree_lock); while (p != initproc) { TAILQ_FOREACH(filemon, &filemons_inuse, link) {