Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys simplify lwp exit code.
details: https://anonhg.NetBSD.org/src/rev/62a1022c372f
branches: trunk
changeset: 584784:62a1022c372f
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Oct 01 06:12:44 2005 +0000
description:
simplify lwp exit code.
diffstat:
sys/kern/kern_exit.c | 6 +++---
sys/kern/kern_lwp.c | 26 +++++++++++++++-----------
sys/sys/lwp.h | 3 +--
3 files changed, 19 insertions(+), 16 deletions(-)
diffs (105 lines):
diff -r 2438f97846ce -r 62a1022c372f sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c Sat Oct 01 05:30:12 2005 +0000
+++ b/sys/kern/kern_exit.c Sat Oct 01 06:12:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exit.c,v 1.151 2005/08/28 14:57:18 yamt Exp $ */
+/* $NetBSD: kern_exit.c,v 1.152 2005/10/01 06:12:44 yamt Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.151 2005/08/28 14:57:18 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.152 2005/10/01 06:12:44 yamt Exp $");
#include "opt_ktrace.h"
#include "opt_perfctrs.h"
@@ -443,7 +443,7 @@
LIST_REMOVE(l, l_list);
LIST_REMOVE(l, l_sibling);
- l->l_flag |= L_DETACHED|L_PROCEXIT; /* detached from proc too */
+ l->l_flag |= L_DETACHED; /* detached from proc too */
l->l_stat = LSDEAD;
KASSERT(p->p_nrlwps == 1);
diff -r 2438f97846ce -r 62a1022c372f sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c Sat Oct 01 05:30:12 2005 +0000
+++ b/sys/kern/kern_lwp.c Sat Oct 01 06:12:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lwp.c,v 1.30 2005/08/28 14:57:18 yamt Exp $ */
+/* $NetBSD: kern_lwp.c,v 1.31 2005/10/01 06:12:44 yamt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.30 2005/08/28 14:57:18 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.31 2005/10/01 06:12:44 yamt Exp $");
#include "opt_multiprocessor.h"
@@ -557,6 +557,19 @@
cpu_lwp_free(l, 0);
#endif
+ pmap_deactivate(l);
+
+ if (l->l_flag & L_DETACHED) {
+ simple_lock(&p->p_lock);
+ LIST_REMOVE(l, l_sibling);
+ p = l->l_proc;
+ p->p_nlwps--;
+ simple_unlock(&p->p_lock);
+
+ curlwp = NULL;
+ l->l_proc = NULL;
+ }
+
SCHED_LOCK(s);
p->p_nrlwps--;
l->l_stat = LSDEAD;
@@ -565,8 +578,6 @@
/* This LWP no longer needs to hold the kernel lock. */
KERNEL_PROC_UNLOCK(l);
- pmap_deactivate(l);
-
/* cpu_exit() will not return */
cpu_exit(l);
}
@@ -593,13 +604,6 @@
if (l->l_flag & L_DETACHED) {
/* Nobody waits for detached LWPs. */
-
- if ((l->l_flag & L_PROCEXIT) == 0) {
- LIST_REMOVE(l, l_sibling);
- p = l->l_proc;
- p->p_nlwps--;
- }
-
pool_put(&lwp_pool, l);
KERNEL_UNLOCK();
} else {
diff -r 2438f97846ce -r 62a1022c372f sys/sys/lwp.h
--- a/sys/sys/lwp.h Sat Oct 01 05:30:12 2005 +0000
+++ b/sys/sys/lwp.h Sat Oct 01 06:12:44 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lwp.h,v 1.29 2005/07/16 17:50:26 christos Exp $ */
+/* $NetBSD: lwp.h,v 1.30 2005/10/01 06:12:44 yamt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -108,7 +108,6 @@
#define L_SELECT 0x00040 /* Selecting; wakeup/waiting danger. */
#define L_SINTR 0x00080 /* Sleep is interruptible. */
#define L_TIMEOUT 0x00400 /* Timing out during sleep. */
-#define L_PROCEXIT 0x00800 /* In process exit, l_proc no longer valid */
#define L_SA 0x100000 /* Scheduler activations LWP */
#define L_SA_UPCALL 0x200000 /* SA upcall is pending */
#define L_SA_BLOCKING 0x400000 /* Blocking in tsleep() */
Home |
Main Index |
Thread Index |
Old Index