Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_kobj.c
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
static MALLOC_DEFINE(M_KOBJ, "kobj", "Kernel object structures"); | static MALLOC_DEFINE(M_KOBJ, "kobj", "Kernel object structures"); | ||||
#ifdef KOBJ_STATS | #ifdef KOBJ_STATS | ||||
u_int kobj_lookup_hits; | u_int kobj_lookup_hits; | ||||
u_int kobj_lookup_misses; | u_int kobj_lookup_misses; | ||||
SYSCTL_UINT(_kern, OID_AUTO, kobj_hits, CTLFLAG_RD, | SYSCTL_UINT(_kern, OID_AUTO, kobj_hits, CTLFLAG_RD, | ||||
&kobj_lookup_hits, 0, ""); | &kobj_lookup_hits, 0, | ||||
"Number of kobj cache hits"); | |||||
SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD, | SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD, | ||||
&kobj_lookup_misses, 0, ""); | &kobj_lookup_misses, 0, | ||||
"Number of kobj cache misses"); | |||||
#endif | #endif | ||||
static struct mtx kobj_mtx; | static struct mtx kobj_mtx; | ||||
static int kobj_mutex_inited; | static int kobj_mutex_inited; | ||||
static int kobj_next_id = 1; | static int kobj_next_id = 1; | ||||
#define KOBJ_LOCK() mtx_lock(&kobj_mtx) | #define KOBJ_LOCK() mtx_lock(&kobj_mtx) | ||||
#define KOBJ_UNLOCK() mtx_unlock(&kobj_mtx) | #define KOBJ_UNLOCK() mtx_unlock(&kobj_mtx) | ||||
#define KOBJ_ASSERT(what) mtx_assert(&kobj_mtx, what); | #define KOBJ_ASSERT(what) mtx_assert(&kobj_mtx, what); | ||||
SYSCTL_INT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD, | SYSCTL_INT(_kern, OID_AUTO, kobj_methodcount, | ||||
&kobj_next_id, 0, ""); | CTLFLAG_RD, &kobj_next_id, 0, | ||||
"Number of kobj methods registered in system"); | |||||
static void | static void | ||||
kobj_init_mutex(void *arg) | kobj_init_mutex(void *arg) | ||||
{ | { | ||||
if (!kobj_mutex_inited) { | if (!kobj_mutex_inited) { | ||||
mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF); | mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF); | ||||
kobj_mutex_inited = 1; | kobj_mutex_inited = 1; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |