Subject: Re: bufpages calculation
To: Ben Harris <bjh21@cam.ac.uk>
From: David Brownlee <abs@netbsd.org>
List: tech-kern
Date: 09/28/2000 14:30:22
On Wed, 27 Sep 2000, Ben Harris wrote:

> In article <E13eFIW-0001DN-00@chiark.greenend.org.uk> you write:
> >In article <Pine.NEB.4.21.0009261904010.276-100000@odysseus.mono.org> you write:
> >>On Mon, 25 Sep 2000, Bill Sommerfeld wrote:
> >>	Currently we calculate bufpages based on physmem. Is uvmexp.free
> >>	valid at that point - if so would it make more sense to calculate
> >>	buffers based on that?
> >
> >It looks like bufpages is currently set in allocsys(), which is called quite
> >early on some architectures.  arm26 and alpha certainly call it long before
> >UVM is initialised.  There's no reason for bufpages to be set this early,
> >though (since actually allocating them needs UVM to be up), so it should
> >perhaps go somewhere else.  main() seems like the obvious place to me.
> 
> Oops.  Of course, allocsys needs to know nbuf so it can allocate buffer
> headers, and nbuf depends to some degree on bufpages, so the whole business
> is less than entirely simple.

	Is it possible to determine how much memory has already been taken
	by the kernel at allocsys time? If so, you can subtract that from
	phymem to use as the basis for working out bufpages. While not
	perfect, it will be a good deal closer than what we have now.

                David/absolute
			       -- www.netbsd.org: A pmap for every occasion --