Subject: Re: sysctl HW_PAGESIZE
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Alfred Perlstein <bright@mu.org>
List: tech-perform
Date: 02/23/2002 12:14:33
* Emmanuel Dreyfus <manu@netbsd.org> [020223 11:39] wrote:
> Hello
> 
> I was debugging sysconf emulation for IRIX and I had to add some printf
> in sysctl() to understand what was going on. 
> 
> Theses debug printf's show me that on each process launch, we do a
> sysctl HW_PAGESIZE to discover the hardware page size. This is spends a
> system call for each program startup to discover something that seems to
> be a hardware constant.
> 
> Maybe this is a stupid question, but... the page size is CPU related,
> right? Is it true that a binary build for a given CPU will always see
> the same page size? If it is, then we could get the page size at build
> time instead of at run time.

Afaik several arches allow for variable page sizes, not just 4k vs 4meg
pages either, something like 4, 8 and 16k pages I've _heard_ for ia64,
it's possible that a system administrator (if the OS allowed it) would
want larger pages on large memory machines or smaller pages on small
memory machines, therefore doing at compile time isn't a really good
idea.  It might make sense to somehow hand that info over to the process
during exec() somehow, a lame way would be to use the environment space
but I'm sure there's more clever ways of doing something like that.

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/