From 1a23213bde00c6d9ac4fdb748694d1eda5e25e0d Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 5 Mar 2014 05:35:55 +0000 Subject: [PATCH] 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. --- sys/uvm/uvm_map.c | 10 +++++----- sys/uvm/uvm_stat.h | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index 1ddbe96a0add..4f5cd7cd9dc0 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -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 -__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,"", 0, 0, 0, 0); diff --git a/sys/uvm/uvm_stat.h b/sys/uvm/uvm_stat.h index 51929a624591..55eb0eb8a63c 100644 --- a/sys/uvm/uvm_stat.h +++ b/sys/uvm/uvm_stat.h @@ -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)