[comp.unix.wizards] SYSPTSIZE is indeed silly

nw@palladium.UUCP (10/21/87)

As it says in vax/vmparam.h (4.3 BSD Mt Xinu):

        /*
         * Sizes of the system and user portions of the system page table.
         */
        /* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */
        #define SYSPTSIZE       ((20+MAXUSERS)*NPTEPG)

This expression seems rather strange to me.  To see why, rewrite it as:

        (20+MAXUSERS)*(NBPG/sizeof(struct pte))

All other things being equal, a large page size (NBPG) would *increase*
SYSPTSIZE.  Isn't this backwards?  A larger page size decreases the amount
of sys pt space you need to map a given amount of memory.

Of course, on a VAX none of this matters because there is but One True Page
Size.  However, it seems that the existing definition works only because
NPTEPG, when multiplied by "typical" values of (20+MAXUSERS), just happens to
result in a SYSPTSIZE that is reasonable.

I would propose a different definition of SYSPTSIZE:

        #define SYSPTSIZE       (MAX_KERNEL_VM / NBPG)

where MAX_KERNEL_VM is defined to be "the most VM you think your kernel will
ever need".  How do you come up with this value?  I don't know.  Perhaps
it is still defined in terms of "MAXUSERS+something".  It's probably just as
good to pick a reasonably large arbitrary value (e.g., 2MB), with an option
to override by config of course.

What you really want to do, as we all know, is compute SYSPTSIZE at boot time.
This would be pretty messy (the computation is not too hard, but the
implications of not knowing SYSPTSIZE at compile time seem pretty ugly).
I doubt it's worth the hassle.

I think the definition of USRPTSIZE is also wrong, but I'll save it for
another day...
-- 
Neil Webber / Epoch Systems, Marlboro MA / (617) 481-3717
        {harvard!cfisun, linus!alliant}!palladium!nw