Subject: Re: NKPDE changes
To: Lennart Augustsson <>
From: Chris G Demetriou <>
List: port-i386
Date: 11/19/1996 08:01:21
> > nkpde is calculated as:
> > 
> > 	NKPDE_BASE + (biosextmem >> 10) * NKPDE_SCALE
> > 	with a maximum of NKPDE_MAX.
> Where does SHMMAXPGS enter into this calculation?
> I know I had to increase NKPDE to be able to use more
> System V shared memory.

In a nutshell, "it doesn't."  However, it's worth noting that
you're quite likely to end up using more KPDEs now than previously,
so it might fix itself automatically.  (if you've got > 9M of RAM,
you're using more KPDEs than you were before, and you get one more per
meg of RAM.)

My goal was to make the default value of NKPDE work on "all systems"
with the default configuration for kernel variables and expecting
"typical" load on the machine (for a pulled-out-of-thin-air definition
of typical 8-).  Therefore, the calculation is a simple one, and
doesn't take into account "interesting" tweakable definitions.  (I
don't feel so bad about this, since: (a) i coded the solution without
knowing i386 assembly, i.e. by simply using the rest of locore as an
example, (b) it's not _my_ problem to be solving in the first place,
and (c) the kernel should now work, by default, with large memory
machines, which was my goal.)

If it's any consolation, if all of my changes were applied:

	(1) you now can tweak NKPDE both directly from your kernel
	    config file, i.e. with 'options NKPDE=...',

	(2) it's now a patchable kernel variable, so that if the
	    default setting _doesn't_ work for you, gdb -w can fix it,

	(3) the value used by the kernel should now be exported via
	    sysctl(), so you can more easily see what it is so you
	    can do (1) and (2).

(I dunno if all of my changes were picked up, but if they were then
you now have that functionality.)

A better (i.e. not 0th-order) solution would take stuff like:

	the kmem_map size,
	the mbuf cluster map size,
	"anything else" used by the kernel

into account in the calculation.  However, I have no idea what all of
that stuff (esp. the latter) is on the i386, so i didn't even try.