1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

MFi386 rev 1.536 (sort of)

Move what can be moved (UMA zones creation, pv_entry_* initialization) from
pmap_init2() to pmap_init().
Create a new function, pmap_postinit(), called from cpu_startup(), to do the
L1 tables allocation.
pmap_init2() is now empty for arm as well.
This commit is contained in:
Olivier Houchard 2005-11-06 16:10:28 +00:00
parent 5eb2dd9421
commit 812779897c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152128
3 changed files with 24 additions and 30 deletions

View File

@ -244,6 +244,7 @@ cpu_startup(void *dummy)
cpu_setup(""); cpu_setup("");
identify_arm_cpu(); identify_arm_cpu();
thread0.td_frame = (struct trapframe *)pcb->un_32.pcb32_sp - 1; thread0.td_frame = (struct trapframe *)pcb->un_32.pcb32_sp - 1;
pmap_postinit();
#ifdef ARM_CACHE_LOCK_ENABLE #ifdef ARM_CACHE_LOCK_ENABLE
pmap_kenter_user(ARM_TP_ADDRESS, ARM_TP_ADDRESS); pmap_kenter_user(ARM_TP_ADDRESS, ARM_TP_ADDRESS);
arm_lock_cache_line(ARM_TP_ADDRESS); arm_lock_cache_line(ARM_TP_ADDRESS);

View File

@ -398,11 +398,6 @@ int pmap_needs_pte_sync;
*/ */
#define PV_BEEN_REFD(f) (((f) & PVF_REF) != 0) #define PV_BEEN_REFD(f) (((f) & PVF_REF) != 0)
/*
* Data for the pv entry allocation mechanism
*/
#define MINPV 2048
#ifndef PMAP_SHPGPERPROC #ifndef PMAP_SHPGPERPROC
#define PMAP_SHPGPERPROC 200 #define PMAP_SHPGPERPROC 200
#endif #endif
@ -1949,6 +1944,7 @@ pmap_page_init(vm_page_t m)
void void
pmap_init(void) pmap_init(void)
{ {
int shpgperproc = PMAP_SHPGPERPROC;
PDEBUG(1, printf("pmap_init: phys_start = %08x\n")); PDEBUG(1, printf("pmap_init: phys_start = %08x\n"));
@ -1957,12 +1953,24 @@ pmap_init(void)
*/ */
pvzone = uma_zcreate("PV ENTRY", sizeof (struct pv_entry), NULL, NULL, pvzone = uma_zcreate("PV ENTRY", sizeof (struct pv_entry), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE); NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE);
uma_prealloc(pvzone, MINPV);
/* /*
* Now it is safe to enable pv_table recording. * Now it is safe to enable pv_table recording.
*/ */
PDEBUG(1, printf("pmap_init: done!\n")); PDEBUG(1, printf("pmap_init: done!\n"));
TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc);
pv_entry_max = shpgperproc * maxproc + vm_page_array_size;
pv_entry_high_water = 9 * (pv_entry_max / 10);
l2zone = uma_zcreate("L2 Table", L2_TABLE_SIZE_REAL, pmap_l2ptp_ctor,
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE);
l2table_zone = uma_zcreate("L2 Table", sizeof(struct l2_dtable),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
UMA_ZONE_VM | UMA_ZONE_NOFREE);
uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max);
uma_zone_set_obj(l2zone, &l2zone_obj, pv_entry_max);
} }
int int
@ -2190,15 +2198,14 @@ pmap_fault_fixup(pmap_t pm, vm_offset_t va, vm_prot_t ftype, int user)
return (rv); return (rv);
} }
/*
* Initialize the address space (zone) for the pv_entries. Set a
* high water mark so that the system can recover from excessive
* numbers of pv entries.
*/
void void
pmap_init2() pmap_init2(void)
{
}
void
pmap_postinit(void)
{ {
int shpgperproc = PMAP_SHPGPERPROC;
struct l2_bucket *l2b; struct l2_bucket *l2b;
struct l1_ttable *l1; struct l1_ttable *l1;
pd_entry_t *pl1pt; pd_entry_t *pl1pt;
@ -2206,21 +2213,6 @@ pmap_init2()
vm_offset_t va, eva; vm_offset_t va, eva;
u_int loop, needed; u_int loop, needed;
TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc);
pv_entry_max = shpgperproc * maxproc + vm_page_array_size;
pv_entry_high_water = 9 * (pv_entry_max / 10);
l2zone = uma_zcreate("L2 Table", L2_TABLE_SIZE_REAL, pmap_l2ptp_ctor,
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE);
uma_prealloc(l2zone, 4096);
l2table_zone = uma_zcreate("L2 Table", sizeof(struct l2_dtable),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
UMA_ZONE_VM | UMA_ZONE_NOFREE);
uma_prealloc(l2table_zone, 1024);
uma_zone_set_obj(pvzone, &pvzone_obj, pv_entry_max);
uma_zone_set_obj(l2zone, &l2zone_obj, pv_entry_max);
needed = (maxproc / PMAP_DOMAINS) + ((maxproc % PMAP_DOMAINS) ? 1 : 0); needed = (maxproc / PMAP_DOMAINS) + ((maxproc % PMAP_DOMAINS) ? 1 : 0);
needed -= 1; needed -= 1;
l1 = malloc(sizeof(*l1) * needed, M_VMPMAP, M_WAITOK); l1 = malloc(sizeof(*l1) * needed, M_VMPMAP, M_WAITOK);
@ -3787,8 +3779,7 @@ pmap_get_pv_entry(void)
pv_entry_t ret_value; pv_entry_t ret_value;
pv_entry_count++; pv_entry_count++;
if (pv_entry_high_water && if ((pv_entry_count > pv_entry_high_water) &&
(pv_entry_count > pv_entry_high_water) &&
(pmap_pagedaemon_waken == 0)) { (pmap_pagedaemon_waken == 0)) {
pmap_pagedaemon_waken = 1; pmap_pagedaemon_waken = 1;
wakeup (&vm_pages_needed); wakeup (&vm_pages_needed);

View File

@ -509,6 +509,8 @@ void pmap_kenter_section(vm_offset_t, vm_paddr_t, int flags);
extern char *_tmppt; extern char *_tmppt;
void pmap_postinit(void);
#ifdef ARM_USE_SMALL_ALLOC #ifdef ARM_USE_SMALL_ALLOC
void arm_add_smallalloc_pages(void *, void *, int, int); void arm_add_smallalloc_pages(void *, void *, int, int);
void arm_busy_pages(void); void arm_busy_pages(void);