Use UVMHIST_INITIALIZER (KERNHIST_INITIALIZER) to statically initialize

maphist.  This allows maphist to used very very early in boot well before
uvm has been initialized.
This commit is contained in:
matt 2014-03-05 05:35:55 +00:00
parent b35517a661
commit 1a23213bde
2 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.327 2013/11/14 12:07:11 martin Exp $ */
/* $NetBSD: uvm_map.c,v 1.328 2014/03/05 05:35:55 matt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.327 2013/11/14 12:07:11 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.328 2014/03/05 05:35:55 matt Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@ -101,7 +101,8 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.327 2013/11/14 12:07:11 martin Exp $")
#endif
#ifdef UVMHIST
UVMHIST_DEFINE(maphist);
static struct kern_history_ent maphistbuf[100];
UVMHIST_DEFINE(maphist) = UVMHIST_INITIALIZER(maphist, maphistbuf);
#endif
#if !defined(UVMMAP_COUNTERS)
@ -875,7 +876,6 @@ void
uvm_map_init(void)
{
#if defined(UVMHIST)
static struct kern_history_ent maphistbuf[100];
static struct kern_history_ent pdhistbuf[100];
#endif
@ -884,7 +884,7 @@ uvm_map_init(void)
*/
UVMHIST_FUNC("uvm_map_init");
UVMHIST_INIT_STATIC(maphist, maphistbuf);
UVMHIST_LINK_STATIC(maphist);
UVMHIST_INIT_STATIC(pdhist, pdhistbuf);
UVMHIST_CALLED(maphist);
UVMHIST_LOG(maphist,"<starting uvm map system>", 0, 0, 0, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_stat.h,v 1.51 2012/07/30 23:56:48 matt Exp $ */
/* $NetBSD: uvm_stat.h,v 1.52 2014/03/05 05:35:55 matt Exp $ */
/*
* Copyright (c) 2011 Matthew R. Green
@ -55,6 +55,8 @@
#define UVMHIST_DEFINE(NAME) KERNHIST_DEFINE(NAME)
#define UVMHIST_INIT(NAME,N) KERNHIST_INIT(NAME,N)
#define UVMHIST_INIT_STATIC(NAME,BUF) KERNHIST_INIT_STATIC(NAME,BUF)
#define UVMHIST_INITIALIZER(NAME,BUF) KERNHIST_INITIALIZER(NAME,BUF)
#define UVMHIST_LINK_STATIC(NAME) KERNHIST_LINK_STATIC(NAME)
#define UVMHIST_LOG(NAME,FMT,A,B,C,D) KERNHIST_LOG(NAME,FMT,A,B,C,D)
#define UVMHIST_CALLED(NAME) KERNHIST_CALLED(NAME)
#define UVMHIST_FUNC(FNAME) KERNHIST_FUNC(FNAME)
@ -65,6 +67,8 @@
#define UVMHIST_DEFINE(NAME)
#define UVMHIST_INIT(NAME,N)
#define UVMHIST_INIT_STATIC(NAME,BUF)
#define UVMHIST_INITIALIZER(NAME,BUF)
#define UVMHIST_LINK_STATIC(NAME)
#define UVMHIST_LOG(NAME,FMT,A,B,C,D)
#define UVMHIST_CALLED(NAME)
#define UVMHIST_FUNC(FNAME)