From owner-svn-src-all@FreeBSD.ORG Thu May 10 09:30:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7D873106566B; Thu, 10 May 2012 09:30:38 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68E938FC08; Thu, 10 May 2012 09:30:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4A9UcMb026599; Thu, 10 May 2012 09:30:38 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4A9UcWI026597; Thu, 10 May 2012 09:30:38 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201205100930.q4A9UcWI026597@svn.freebsd.org> From: David Xu Date: Thu, 10 May 2012 09:30:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235218 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 09:30:38 -0000 Author: davidxu Date: Thu May 10 09:30:37 2012 New Revision: 235218 URL: http://svn.freebsd.org/changeset/base/235218 Log: Create a common function lookup() to search a chan, this eliminates redundant SC_LOOKUP() calling. Modified: head/lib/libthr/thread/thr_sleepq.c Modified: head/lib/libthr/thread/thr_sleepq.c ============================================================================== --- head/lib/libthr/thread/thr_sleepq.c Thu May 10 09:10:31 2012 (r235217) +++ head/lib/libthr/thread/thr_sleepq.c Thu May 10 09:30:37 2012 (r235218) @@ -94,19 +94,23 @@ _sleepq_unlock(void *wchan) THR_LOCK_RELEASE(curthread, &sc->sc_lock); } -struct sleepqueue * -_sleepq_lookup(void *wchan) +static inline struct sleepqueue * +lookup(struct sleepqueue_chain *sc, void *wchan) { - struct sleepqueue_chain *sc; struct sleepqueue *sq; - sc = SC_LOOKUP(wchan); LIST_FOREACH(sq, &sc->sc_queues, sq_hash) if (sq->sq_wchan == wchan) return (sq); return (NULL); } +struct sleepqueue * +_sleepq_lookup(void *wchan) +{ + return (lookup(SC_LOOKUP(wchan), wchan)); +} + void _sleepq_add(void *wchan, struct pthread *td) { @@ -114,7 +118,7 @@ _sleepq_add(void *wchan, struct pthread struct sleepqueue *sq; sc = SC_LOOKUP(wchan); - sq = _sleepq_lookup(wchan); + sq = lookup(sc, wchan); if (sq != NULL) { SLIST_INSERT_HEAD(&sq->sq_freeq, td->sleepqueue, sq_flink); } else {