Subject: special treatment of "residual" buffers in machdep.c?
To: None <tech-kern@NetBSD.ORG, port-i386@NetBSD.ORG>
From: Thor Lancelot Simon <tls@panix.com>
List: tech-kern
Date: 12/08/1996 05:51:09
>       base = bufpages / nbuf;
>       residual = bufpages % nbuf;
>       for (i = 0; i < nbuf; i++) {
>               vm_size_t curbufsize;
>               vm_offset_t curbuf;
>
>               /*
>                * First <residual> buffers get (base+1) physical pages
>                * allocated for them.  The rest get (base) physical pages.
>                *
>                * The rest of each buffer occupies virtual space,
>                * but has no physical memory allocated for it.
>                */
>               curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
>               curbufsize = CLBYTES * (i < residual ? base+1 : base);
>               vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
>               vm_map_simplify(buffer_map, curbuf);

	A) Often (usually?) nbuf = bufpages.  So this does nothing.

	B) Isn't it wrong, anyway?  Let's say I've got nbuf = 512, and
	   bufpages = 768.  I'll allocate 512 pages to the "residual" buffers,
	   and 512 pages to the rest of the buffers, for a total of 1024
           pages allocated.

Thor