summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/lwp.c
diff options
context:
space:
mode:
authorpt157919 <none@none>2008-01-14 14:41:14 -0800
committerpt157919 <none@none>2008-01-14 14:41:14 -0800
commit575a742678105d588b7c8e1653b57a7e3d78440b (patch)
tree668210ed5e1db9b1a50a4b908b71ae185857182d /usr/src/uts/common/os/lwp.c
parent8436ade26aba9b9e816d73f396e44d9abc90add0 (diff)
downloadillumos-gate-575a742678105d588b7c8e1653b57a7e3d78440b.tar.gz
6182418 mutex_vector_enter has scaling issues on 25k
6292850 kernel code for multistrand CPUs should avoid spin loops (mutex_vector_enter) 6535018 mutex performance sub-optimal on some platforms
Diffstat (limited to 'usr/src/uts/common/os/lwp.c')
-rw-r--r--usr/src/uts/common/os/lwp.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/usr/src/uts/common/os/lwp.c b/usr/src/uts/common/os/lwp.c
index a925f979a4..a9f1aa2588 100644
--- a/usr/src/uts/common/os/lwp.c
+++ b/usr/src/uts/common/os/lwp.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -61,6 +61,8 @@
#include <sys/brand.h>
void *segkp_lwp; /* cookie for pool of segkp resources */
+extern void reapq_move_lq_to_tq(kthread_t *);
+extern void freectx_ctx(struct ctxop *);
/*
* Create a thread that appears to be stopped at sys_rtt.
@@ -88,6 +90,7 @@ lwp_create(void (*proc)(), caddr_t arg, size_t len, proc_t *p,
int i;
int rctlfail = 0;
boolean_t branded = 0;
+ struct ctxop *ctx = NULL;
mutex_enter(&p->p_lock);
mutex_enter(&p->p_zone->zone_nlwps_lock);
@@ -136,14 +139,18 @@ lwp_create(void (*proc)(), caddr_t arg, size_t len, proc_t *p,
lwp_reapcnt--;
lwpdata = t->t_swap;
lwp = t->t_lwp;
- }
- mutex_exit(&reaplock);
- if (t) {
+ ctx = t->t_ctx;
t->t_swap = NULL;
- lwp_stk_fini(t->t_lwp);
t->t_lwp = NULL;
- t->t_forw = NULL;
- thread_free(t);
+ t->t_ctx = NULL;
+ reapq_move_lq_to_tq(t);
+ }
+ mutex_exit(&reaplock);
+ if (lwp != NULL) {
+ lwp_stk_fini(lwp);
+ }
+ if (ctx != NULL) {
+ freectx_ctx(ctx);
}
}
if (lwpdata == NULL &&
@@ -250,7 +257,7 @@ grow:
ldp->ld_next = ldp + 1;
new_hashsz = (new_dirsz + 2) / 2;
new_hash = kmem_zalloc(new_hashsz * sizeof (lwpdir_t *),
- KM_SLEEP);
+ KM_SLEEP);
mutex_enter(&p->p_lock);
if (p == curproc)