Tunables (Re: How to debug a double fault? (Re: Could MSGBUF_SIZE be made a loader tunable?))

perryh at pluto.rain.com perryh at pluto.rain.com
Sun Dec 19 09:20:33 UTC 2010

Andriy Gapon <avg at freebsd.org> wrote:
> on 16/12/2010 11:34 perryh at pluto.rain.com said the following:
> > Andriy Gapon <avg at freebsd.org> wrote:
> >> BTW, are you sure that you correctly placed initialization of
> >> msgbufsize ?
> > 
> > I am not at all sure of that ...
> > 
> > Apart from the name, msgbufsize is set up in exactly the same
> > way and place -- in init_param1() -- as maxswzone and maxbcache.
> > Perhaps that is not early enough ...
> I don't see any connection between msgbufsize and maxswzone,
> so I also don't know if that place is early enough.

The only "connection" is that maxswzone and maxbcache seemed to
be loader tunables that cannot be changed (via sysctl) while the
system is running -- the same usage paradigm I have in mind for

I've since found the description of i386 startup in the Architecture
Handbook, and based on that -- and the code in locore.s and machdep.c
-- it certainly _seems_ as if init_param1() should be early enough:

Practically the first thing that locore.s does after establishing
virtual addressing is to call init386(), and init386() calls
init_param1() long before it either accesses msgbufsize directly
or calls getmemsize() (which uses msgbufsize to allocate space for
the kernel message buffer).

> Just try to initialize the variable where it's defined and use

Is there any documentation on how to use the TUNABLE_* macros, or
on when to use, say, TUNABLE_LONG vs TUNABLE_LONG_FETCH?  I found
nothing with their definitions in sys/kernel.h, nor in any of the
base-system manpages, nor in /usr/share/doc/...

More information about the freebsd-stable mailing list