Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Remove lwp_uc_pool, replace it with kmem(9), plus add so...



details:   https://anonhg.NetBSD.org/src/rev/49288a9a670d
branches:  trunk
changeset: 754214:49288a9a670d
user:      rmind <rmind%NetBSD.org@localhost>
date:      Fri Apr 23 19:18:09 2010 +0000

description:
Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.

diffstat:

 sys/arch/alpha/alpha/trap.c                 |  19 ++++++--------
 sys/arch/amd64/amd64/netbsd32_machdep.c     |  14 ++++++----
 sys/arch/amd64/amd64/trap.c                 |   9 +++---
 sys/arch/arm/arm/arm_machdep.c              |  19 ++++++--------
 sys/arch/hppa/hppa/trap.c                   |  20 ++++++---------
 sys/arch/i386/i386/trap.c                   |   9 +++---
 sys/arch/m68k/m68k/m68k_syscall.c           |  18 +++++--------
 sys/arch/mips/mips/mips_machdep.c           |  37 ++++++++++++----------------
 sys/arch/powerpc/ibm4xx/trap.c              |  20 ++++++---------
 sys/arch/powerpc/powerpc/trap.c             |  22 +++++++---------
 sys/arch/sh3/sh3/vm_machdep.c               |  15 +++-------
 sys/arch/sparc/sparc/trap.c                 |  21 ++++++----------
 sys/arch/sparc64/sparc64/netbsd32_machdep.c |  19 ++++++--------
 sys/arch/sparc64/sparc64/syscall.c          |  21 ++++++----------
 sys/arch/vax/vax/trap.c                     |  20 ++++++---------
 sys/kern/kern_lwp.c                         |  13 +++-------
 sys/kern/sys_lwp.c                          |  15 +++++------
 sys/sys/lwp.h                               |   5 +---
 18 files changed, 132 insertions(+), 184 deletions(-)

diffs (truncated from 878 to 300 lines):

diff -r 12a72ae11359 -r 49288a9a670d sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c       Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/alpha/alpha/trap.c       Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.122 2010/03/20 23:31:27 chs Exp $ */
+/* $NetBSD: trap.c,v 1.123 2010/04/23 19:18:09 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.122 2010/03/20 23:31:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.123 2010/04/23 19:18:09 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,6 +103,7 @@
 #include <sys/syscall.h>
 #include <sys/buf.h>
 #include <sys/kauth.h>
+#include <sys/kmem.h>
 #include <sys/cpu.h>
 #include <sys/atomic.h>
 
@@ -1218,18 +1219,14 @@
 void
 startlwp(void *arg)
 {
-       int err;
        ucontext_t *uc = arg;
-       struct lwp *l = curlwp;
+       lwp_t *l = curlwp;
+       int error;
 
-       err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
-#if DIAGNOSTIC
-       if (err) {
-               printf("Error %d from cpu_setmcontext.", err);
-       }
-#endif
-       pool_put(&lwp_uc_pool, uc);
+       error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
+       KASSERT(error == 0);
 
+       kmem_free(uc, sizeof(ucontext_t));
        userret(l);
 }
 
diff -r 12a72ae11359 -r 49288a9a670d sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.61 2009/12/10 14:13:49 matt Exp $       */
+/*     $NetBSD: netbsd32_machdep.c,v 1.62 2010/04/23 19:18:09 rmind Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.61 2009/12/10 14:13:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.62 2010/04/23 19:18:09 rmind Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -937,13 +937,15 @@
 void
 startlwp32(void *arg)
 {
-       int err;
        ucontext32_t *uc = arg;
-       struct lwp *l = curlwp;
+       lwp_t *l = curlwp;
+       int error;
 
-       err = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
-       pool_put(&lwp_uc_pool, uc);
+       error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
+       KASSERT(error == 0);
 
+       /* Note: we are freeing ucontext_t, not ucontext32_t. */
+       kmem_free(uc, sizeof(ucontext_t));
        userret(l);
 }
 
diff -r 12a72ae11359 -r 49288a9a670d sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c       Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/amd64/amd64/trap.c       Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.61 2010/02/23 06:27:40 cegger Exp $ */
+/*     $NetBSD: trap.c,v 1.62 2010/04/23 19:18:09 rmind Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.61 2010/02/23 06:27:40 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.62 2010/04/23 19:18:09 rmind Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -81,7 +81,7 @@
 #include <sys/acct.h>
 #include <sys/kauth.h>
 #include <sys/kernel.h>
-#include <sys/pool.h>
+#include <sys/kmem.h>
 #include <sys/ras.h>
 #include <sys/signal.h>
 #include <sys/syscall.h>
@@ -719,7 +719,8 @@
 
        error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
        KASSERT(error == 0);
-       pool_put(&lwp_uc_pool, uc);
+
+       kmem_free(uc, sizeof(ucontext_t));
        userret(l);
 }
 
diff -r 12a72ae11359 -r 49288a9a670d sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c    Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c    Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm_machdep.c,v 1.27 2009/12/10 14:13:49 matt Exp $    */
+/*     $NetBSD: arm_machdep.c,v 1.28 2010/04/23 19:18:09 rmind Exp $   */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -79,12 +79,12 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.27 2009/12/10 14:13:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.28 2010/04/23 19:18:09 rmind Exp $");
 
 #include <sys/exec.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
-#include <sys/pool.h>
+#include <sys/kmem.h>
 #include <sys/ucontext.h>
 #include <sys/evcnt.h>
 #include <sys/cpu.h>
@@ -190,17 +190,14 @@
 void
 startlwp(void *arg)
 {
-       int err;
        ucontext_t *uc = arg; 
-       struct lwp *l = curlwp;
+       lwp_t *l = curlwp;
+       int error;
 
-       err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
-#ifdef DIAGNOSTIC
-       if (err)
-               printf("Error %d from cpu_setmcontext.", err);
-#endif
-       pool_put(&lwp_uc_pool, uc);
+       error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
+       KASSERT(error == 0);
 
+       kmem_free(uc, sizeof(ucontext_t));
        userret(l);
 }
 
diff -r 12a72ae11359 -r 49288a9a670d sys/arch/hppa/hppa/trap.c
--- a/sys/arch/hppa/hppa/trap.c Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/hppa/hppa/trap.c Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.87 2010/04/06 07:44:09 skrll Exp $  */
+/*     $NetBSD: trap.c,v 1.88 2010/04/23 19:18:09 rmind Exp $  */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2010/04/06 07:44:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.88 2010/04/23 19:18:09 rmind Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -82,7 +82,7 @@
 #include <sys/acct.h>
 #include <sys/signal.h>
 #include <sys/device.h>
-#include <sys/pool.h>
+#include <sys/kmem.h>
 #include <sys/userret.h>
 
 #include <net/netisr.h>
@@ -1295,18 +1295,14 @@
 void
 startlwp(void *arg)
 {
-       int err;
        ucontext_t *uc = arg;
-       struct lwp *l = curlwp;
+       lwp_t *l = curlwp;
+       int error;
 
-       err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
-#if DIAGNOSTIC
-       if (err) {
-               printf("Error %d from cpu_setmcontext.", err);
-       }
-#endif
-       pool_put(&lwp_uc_pool, uc);
+       error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
+       KASSERT(error == 0);
 
+       kmem_free(uc, sizeof(ucontext_t));
        userret(l, l->l_md.md_regs->tf_iioq_head, 0);
 }
 
diff -r 12a72ae11359 -r 49288a9a670d sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/i386/i386/trap.c Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.255 2010/02/22 06:42:14 darran Exp $        */
+/*     $NetBSD: trap.c,v 1.256 2010/04/23 19:18:09 rmind Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.255 2010/02/22 06:42:14 darran Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.256 2010/04/23 19:18:09 rmind Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -86,7 +86,7 @@
 #include <sys/acct.h>
 #include <sys/kauth.h>
 #include <sys/kernel.h>
-#include <sys/pool.h>
+#include <sys/kmem.h>
 #include <sys/ras.h>
 #include <sys/signal.h>
 #include <sys/syscall.h>
@@ -860,7 +860,8 @@
 
        error = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
        KASSERT(error == 0);
-       pool_put(&lwp_uc_pool, uc);
+
+       kmem_free(uc, sizeof(ucontext_t));
        userret(l);
 }
 
diff -r 12a72ae11359 -r 49288a9a670d sys/arch/m68k/m68k/m68k_syscall.c
--- a/sys/arch/m68k/m68k/m68k_syscall.c Fri Apr 23 19:17:07 2010 +0000
+++ b/sys/arch/m68k/m68k/m68k_syscall.c Fri Apr 23 19:18:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: m68k_syscall.c,v 1.39 2010/02/25 07:17:48 skrll Exp $  */
+/*     $NetBSD: m68k_syscall.c,v 1.40 2010/04/23 19:18:09 rmind Exp $  */
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.39 2010/02/25 07:17:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m68k_syscall.c,v 1.40 2010/04/23 19:18:09 rmind Exp $");
 
 #include "opt_execfmt.h"
 #include "opt_compat_netbsd.h"
@@ -483,23 +483,19 @@
 void
 startlwp(void *arg)
 {
-       int err;
        ucontext_t *uc = arg;
-       struct lwp *l = curlwp;
+       lwp_t *l = curlwp;
        struct frame *f = (struct frame *)l->l_md.md_regs;
+       int error;
 
        f->f_regs[D0] = 0;
        f->f_sr &= ~PSL_C;
        f->f_format = FMT0;
 
-       err = cpu_setmcontext(l, &uc->uc_mcontext, uc->uc_flags);
-#if DIAGNOSTIC
-       if (err) {
-               printf("Error %d from cpu_setmcontext.", err);
-       }
-#endif
-       pool_put(&lwp_uc_pool, uc);



Home | Main Index | Thread Index | Old Index