Subject: Should kernel parameters be preprocessor constants or variables?
To: None <tech-kern@NetBSD.ORG>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: tech-kern
Date: 02/09/1995 21:41:03
I frequently find myself changing kernel parameters like
NMBCLUSTERS, almost at random.   I notice that such
values aren't used terribly often, usually early during the
bootstrap process.   So there shouldn't be
a noticeable performance degradation if, isentad of being
preprocessor constants, they were actually _variables_
initialized from preprocessor constants -- which would
make it *much* easier to tweak them without requiring
a nearly full kernel recompilation.

Now it turns out that many such parameters *already* have
corresponding variables in param.c; presumably so that
code like systat and vmstat and ps can find the values
of kernel parameters.

Is there any reason (apart from historical) to not replace
all usages of such preprocessor tokens with a reference
to the corresponding variable?

(Doing this in a clean way would clearly require some
reorganization of param.c and the header files it includes,
so that the proper dependencies are observed by make; otherwise,
one could just Hack Things with touch(1), and expert
knowledge of the actual dependencies on a given parameter.
But that's what I'm trying to avoid...)


It would be even nicer to be able to  change such things
on a running system; but I *do* understand how far-reaching
a change that would be, having seen it happen to other OSes.
I volunteer to do the first, should it be deemed acceptable
by Core, but not the second :)

--Jonathan Stone