Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumpuser Use __thread rather than pthread_getspecific...
details: https://anonhg.NetBSD.org/src/rev/71975e5ffffb
branches: trunk
changeset: 327520:71975e5ffffb
user: justin <justin%NetBSD.org@localhost>
date: Sun Mar 09 23:01:11 2014 +0000
description:
Use __thread rather than pthread_getspecific for rumpuser curlwp.
This has better performance and curlwp is a performance bottleneck
in rump kernel code.
diffstat:
lib/librumpuser/rumpuser_pth.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diffs (68 lines):
diff -r 9fcde59b2edd -r 71975e5ffffb lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c Sun Mar 09 22:31:25 2014 +0000
+++ b/lib/librumpuser/rumpuser_pth.c Sun Mar 09 23:01:11 2014 +0000
@@ -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 @@
* 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 @@
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 @@
rumpuser_curlwp(void)
{
- return pthread_getspecific(curlwpkey);
+ return curlwp;
}
#endif
@@ -738,5 +740,5 @@
void
rumpuser__thrinit(void)
{
- pthread_key_create(&curlwpkey, NULL);
+
}
Home |
Main Index |
Thread Index |
Old Index