Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jun 2012 18:55:06 +0000
From:      gmiller@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r238347 - in soc2012/gmiller/locking-head: . lib/libwitness
Message-ID:  <20120626185506.46F23106566B@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120626185506.46F23106566B>