From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 18:55:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 46F23106566B for ; Tue, 26 Jun 2012 18:55:06 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 18:55:06 +0000 Date: Tue, 26 Jun 2012 18:55:06 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626185506.46F23106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238347 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 18:55:07 -0000 Author: gmiller Date: Tue Jun 26 18:55:06 2012 New Revision: 238347 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238347 Log: r238354@FreeBSD-dev: root | 2012-06-19 20:48:01 -0500 Move per-thread lock list heads to TLS. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/lists.c soc2012/gmiller/locking-head/lib/libwitness/lists.h Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 18:54:54 2012 (r238346) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 18:55:06 2012 (r238347) @@ -31,31 +31,31 @@ #include "lists.h" -SLIST_HEAD(lock_lists_head, lock_lists_next) lock_lists_head = - SLIST_HEAD_INITIALIZER(lock_lists_head); - -static struct lock_list * -get_lock_list(void) -{ - return NULL; -} +_Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = + SLIST_HEAD_INITIALIZER(lock_head); void add_lock(void *lock) { - struct lock_list *lock_list; + struct lock_entry *entry; - lock = lock; + entry = malloc(sizeof(*entry)); + entry->lock = lock; - lock_list = get_lock_list(); + SLIST_INSERT_HEAD(&lock_head, entry, lock_next); } void remove_lock(void *lock) { - struct lock_list *lock_list; - - lock = lock; + struct lock_entry *entry; + struct lock_entry *temp; - lock_list = get_lock_list(); + SLIST_FOREACH_SAFE(entry, &lock_head, lock_next, temp) { + if (entry->lock == lock) { + SLIST_REMOVE(&lock_head, entry, lock_entry, lock_next); + free(entry); + break; + } + } } Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.h Tue Jun 26 18:54:54 2012 (r238346) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.h Tue Jun 26 18:55:06 2012 (r238347) @@ -25,7 +25,9 @@ * */ -struct lock_list { +struct lock_entry { + SLIST_ENTRY(lock_entry) lock_next; + void *lock; }; void add_lock(void *lock);