Module Name:    src
Committed By:   justin
Date:           Sun Mar  9 23:01:11 UTC 2014

Modified Files:
        src/lib/librumpuser: rumpuser_pth.c

Log Message:
Use __thread rather than pthread_getspecific for rumpuser curlwp.
This has better performance and curlwp is a performance bottleneck
in rump kernel code.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/librumpuser/rumpuser_pth.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpuser/rumpuser_pth.c
diff -u src/lib/librumpuser/rumpuser_pth.c:1.34 src/lib/librumpuser/rumpuser_pth.c:1.35
--- src/lib/librumpuser/rumpuser_pth.c:1.34	Sun Oct 27 16:39:46 2013
+++ src/lib/librumpuser/rumpuser_pth.c	Sun Mar  9 23:01:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_pth.c,v 1.34 2013/10/27 16:39:46 rmind Exp $	*/
+/*	$NetBSD: rumpuser_pth.c,v 1.35 2014/03/09 23:01:11 justin Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.34 2013/10/27 16:39:46 rmind Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.35 2014/03/09 23:01:11 justin Exp $");
 #endif /* !lint */
 
 #include <sys/queue.h>
@@ -622,13 +622,15 @@ rumpuser_cv_has_waiters(struct rumpuser_
  * curlwp
  */
 
-static pthread_key_t curlwpkey;
+static __thread struct lwp *curlwp;
 
 /*
  * the if0'd curlwp implementation is not used by this hypervisor,
  * but serves as test code to check that the intended usage works.
  */
 #if 0
+static pthread_key_t curlwpkey;
+
 struct rumpuser_lwp {
 	struct lwp *l;
 	LIST_ENTRY(rumpuser_lwp) l_entries;
@@ -716,12 +718,12 @@ rumpuser_curlwpop(int enum_rumplwpop, st
 	case RUMPUSER_LWP_DESTROY:
 		break;
 	case RUMPUSER_LWP_SET:
-		assert(pthread_getspecific(curlwpkey) == NULL);
-		pthread_setspecific(curlwpkey, l);
+		assert(curlwp == NULL);
+		curlwp = l;
 		break;
 	case RUMPUSER_LWP_CLEAR:
-		assert(pthread_getspecific(curlwpkey) == l);
-		pthread_setspecific(curlwpkey, NULL);
+		assert(curlwp == l);
+		curlwp = NULL;
 		break;
 	}
 }
@@ -730,7 +732,7 @@ struct lwp *
 rumpuser_curlwp(void)
 {
 
-	return pthread_getspecific(curlwpkey);
+	return curlwp;
 }
 #endif
 
@@ -738,5 +740,5 @@ rumpuser_curlwp(void)
 void
 rumpuser__thrinit(void)
 {
-	pthread_key_create(&curlwpkey, NULL);
+
 }

Reply via email to