Subject: Re: Sparseness of kernel structures on i386?
To: None <port-i386@NetBSD.ORG, tls@rek.tjls.com>
From: Wolfgang Solfrank <ws@kurt.tools.de>
List: port-i386
Date: 12/08/1996 18:39:52
> Theo was kind enough to point out to me that OpenBSD has the following code in
> machdep.c, which would seem easy enough to pick up:
> 
>         /* Restrict to at most 70% filled kvm */
>         if (bufpages * MAXBSIZE * 7 / 10 >
>             (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS))
>                 bufpages = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) /
>                     MAXBSIZE * 7 / 10;

Hmm, this doesn't do what it intends to do.

For one thing it should be nbuf, not bufpages as you point out in another
message to the list.

However... this restricts the number of bufpages so that 70% of the buffer
space doesn't exceed the kernel virtual space!

The correct code should read something like this:

        /* Restrict to at most 70% filled kvm */
        if (nbuf * MAXBSIZE >    
            (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) * 7 / 10)
                nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) * 7 / 10 /
                    MAXBSIZE;
--
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800