about NKPT on amd64

fuzhli fuzhli1007 at gmail.com
Fri Apr 1 11:53:18 UTC 2011


Hi, Alan Cox
    Thanks for your reply. I want to know why the NKPT set to 32 in
revision187465,
is it possible that set NKPT less or lager than 32? What's the limitation if
set NKPT to 32?

    I also guess the KPTphys[] not used in kernel initialization on amd64 in
revision187465. And
I notice that in revision189075, in function pmap_init() "the vm page array
entries for the kernel
pmap's page table pages" is initialized; but in revision187458, the
initialization is not performed.

    I guess "the earlist part of the kernel's initialization" is the
pmap_bootstrap(firstaddr),
this will call function create_pagetables().
    In function create_pagetables(), we first use allocpages(firstaddr,
NKPT) to
allocate NKPT pages, then initialize the KPTphys[] and KPDphys[]. But then
the KPDphys[] re-initialize the range (0, *firstaddr) in 2MB page:

	/* Map from zero to end of allocations under 2M pages */
	/* This replaces some of the KPTphys entries above */
	for (i = 0; (i << PDRSHIFT) < *firstaddr; i++) {
		((pd_entry_t *)KPDphys)[i] = i << PDRSHIFT;
		((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G;
	}

 This means that the KPDphys[] will be override completely if the range
(KERNBASE, virtual_avail)'s size larger than 64MB, so I guess that the
KPTphys[]
not used anymore if the range (KERNBASE, virtual_avail)'s size larger than
64MB.

在 2011年3月30日 下午11:50,Alan Cox <alc at rice.edu>写道:

> On 03/30/2011 01:47, fuzhli wrote:
> > Hi, Alan
> > I'm study the "Revision 187465" : "Prepare for a larger kernel virtual
> > address space". After read some relative source code, I have an
> > question about the macro NKPT on amd64: why 32 is enough for the
> > kernel page table pages? Do it means that the range (KERNBASE,
> > virtual_avail) should always less than 64MB( 32 * 2MB)?
>
> NKPT sets the size of the kernel page table during the earliest part of
>
the kernel's initialization. After that, the size of the page table
> grows dynamically according to usage.
>
> Regards,
> Alan
>
>


-- 
别做梦,你已24岁了


More information about the freebsd-questions mailing list