Add a MUTEX_NODEBUG type that avoids allocating debugging resources for
the lock. To be used for e.g. struct vm_page until a better way is found.
This commit is contained in:
parent
64e54fbb70
commit
b1da576054
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_mutex.c,v 1.10 2007/03/09 14:08:26 ad Exp $ */
|
||||
/* $NetBSD: kern_mutex.c,v 1.11 2007/03/10 16:01:13 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -49,7 +49,7 @@
|
|||
#define __MUTEX_PRIVATE
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.10 2007/03/09 14:08:26 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.11 2007/03/10 16:01:13 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
|
@ -313,6 +313,11 @@ mutex_init(kmutex_t *mtx, kmutex_type_t type, int ipl)
|
|||
type = (ipl == IPL_NONE ? MUTEX_ADAPTIVE : MUTEX_SPIN);
|
||||
|
||||
switch (type) {
|
||||
case MUTEX_NODEBUG:
|
||||
KASSERT(ipl == IPL_NONE);
|
||||
id = LOCKDEBUG_ALLOC(mtx, NULL);
|
||||
MUTEX_INITIALIZE_ADAPTIVE(mtx, id);
|
||||
break;
|
||||
case MUTEX_ADAPTIVE:
|
||||
case MUTEX_DEFAULT:
|
||||
KASSERT(ipl == IPL_NONE);
|
||||
|
@ -687,7 +692,7 @@ mutex_vector_exit(kmutex_t *mtx)
|
|||
return;
|
||||
}
|
||||
|
||||
if (__predict_false(panicstr != NULL) || __predict_false(cold)) {
|
||||
if (__predict_false((uintptr_t)panicstr | cold)) {
|
||||
MUTEX_UNLOCKED(mtx);
|
||||
MUTEX_RELEASE(mtx);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mutex.h,v 1.8 2007/03/09 04:50:36 thorpej Exp $ */
|
||||
/* $NetBSD: mutex.h,v 1.9 2007/03/10 16:01:13 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -152,11 +152,16 @@
|
|||
#include <sys/inttypes.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MUTEX_NODEBUG disables most LOCKDEBUG checks for the lock. It should
|
||||
* not be used.
|
||||
*/
|
||||
typedef enum kmutex_type_t {
|
||||
MUTEX_SPIN = 0,
|
||||
MUTEX_ADAPTIVE = 1,
|
||||
MUTEX_DEFAULT = 2,
|
||||
MUTEX_DRIVER = 3
|
||||
MUTEX_DRIVER = 3,
|
||||
MUTEX_NODEBUG = 4
|
||||
} kmutex_type_t;
|
||||
|
||||
typedef struct kmutex kmutex_t;
|
||||
|
|
Loading…
Reference in New Issue