Remove kernel locks around malloc introduced when I added SMP support.

This commit is contained in:
nakayama 2008-04-09 15:21:02 +00:00
parent 39b07dd47b
commit c43d57923a
3 changed files with 6 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.218 2008/04/03 10:34:46 nakayama Exp $ */
/* $NetBSD: machdep.c,v 1.219 2008/04/09 15:21:02 nakayama Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.218 2008/04/03 10:34:46 nakayama Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.219 2008/04/09 15:21:02 nakayama Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -1925,10 +1925,8 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
* by lazy FPU context switching); allocate it if necessary.
*/
if ((fsp = l->l_md.md_fpstate) == NULL) {
KERNEL_LOCK(1, l);
fsp = malloc(sizeof (*fsp), M_SUBPROC, M_WAITOK);
l->l_md.md_fpstate = fsp;
KERNEL_UNLOCK_ONE(l);
} else {
/* Drop the live context on the floor. */
fpusave_lwp(l, false);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.77 2008/03/21 21:54:58 ad Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.78 2008/04/09 15:21:02 nakayama Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.77 2008/03/21 21:54:58 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.78 2008/04/09 15:21:02 nakayama Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -889,10 +889,8 @@ netbsd32_cpu_setmcontext(l, mcp, flags)
* XXX immediately or just fault it in later?
*/
if ((fsp = l->l_md.md_fpstate) == NULL) {
KERNEL_LOCK(1, l);
fsp = malloc(sizeof (*fsp), M_SUBPROC, M_WAITOK);
l->l_md.md_fpstate = fsp;
KERNEL_UNLOCK_ONE(l);
} else {
/* Drop the live context on the floor. */
fpusave_lwp(l, false);
@ -1207,10 +1205,8 @@ cpu_setmcontext32(struct lwp *l, const mcontext32_t *mcp, unsigned int flags)
* by lazy FPU context switching); allocate it if necessary.
*/
if ((fsp = l->l_md.md_fpstate) == NULL) {
KERNEL_LOCK(1, l);
fsp = malloc(sizeof (*fsp), M_SUBPROC, M_WAITOK);
l->l_md.md_fpstate = fsp;
KERNEL_UNLOCK_ONE(l);
} else {
/* Drop the live context on the floor. */
fpusave_lwp(l, false);

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.146 2008/03/14 15:39:18 nakayama Exp $ */
/* $NetBSD: trap.c,v 1.147 2008/04/09 15:21:02 nakayama Exp $ */
/*
* Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.146 2008/03/14 15:39:18 nakayama Exp $");
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.147 2008/04/09 15:21:02 nakayama Exp $");
#define NEW_FPSTATE
@ -680,13 +680,11 @@ badtrap:
struct fpstate64 *fs = l->l_md.md_fpstate;
if (fs == NULL) {
KERNEL_LOCK(1, l);
/* NOTE: fpstate must be 64-bit aligned */
fs = malloc((sizeof *fs), M_SUBPROC, M_WAITOK);
*fs = initfpstate;
fs->fs_qsize = 0;
l->l_md.md_fpstate = fs;
KERNEL_UNLOCK_ONE(l);
}
/*
* We may have more FPEs stored up and/or ops queued.
@ -877,10 +875,8 @@ badtrap:
break;
}
if (sig != 0) {
KERNEL_LOCK(1, l);
ksi.ksi_signo = sig;
trapsignal(l, &ksi);
KERNEL_UNLOCK_LAST(l);
}
userret(l, pc, sticks);
share_fpu(l, tf);