diff options
author | peter <peter@FreeBSD.org> | 2002-07-07 23:05:27 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-07-07 23:05:27 +0000 |
commit | b73c441dad47d23a66fa7545b63e35e625225808 (patch) | |
tree | 74cd2868c7e5812fca8fc59540abac90c945c633 /sys/ia64 | |
parent | 9c4815fb2170a6fe82ab28145f6a5d1f8741df10 (diff) | |
download | FreeBSD-src-b73c441dad47d23a66fa7545b63e35e625225808.zip FreeBSD-src-b73c441dad47d23a66fa7545b63e35e625225808.tar.gz |
Collect all the (now equivalent) pmap_new_proc/pmap_dispose_proc/
pmap_swapin_proc/pmap_swapout_proc functions from the MD pmap code
and use a single equivalent MI version. There are other cleanups
needed still.
While here, use the UMA zone hooks to keep a cache of preinitialized
proc structures handy, just like the thread system does. This eliminates
one dependency on 'struct proc' being persistent even after being freed.
There are some comments about things that can be factored out into
ctor/dtor functions if it is worth it. For now they are mostly just
doing statistics to get a feel of how it is working.
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/pmap.c | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 5bf1aeb..1ccac9c 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -707,154 +707,6 @@ pmap_track_modified(vm_offset_t va) } /* - * Create the U area for a new process. - * This routine directly affects the fork perf for a process. - */ -void -pmap_new_proc(struct proc *p) -{ - vm_page_t ma[UAREA_PAGES]; - vm_object_t upobj; - vm_offset_t up; - vm_page_t m; - u_int i; - - /* - * Allocate object for the upage. - */ - upobj = p->p_upages_obj; - if (upobj == NULL) { - upobj = vm_object_allocate(OBJT_DEFAULT, UAREA_PAGES); - p->p_upages_obj = upobj; - } - - /* - * Get a kernel virtual address for the U area for this process. - */ - up = (vm_offset_t)p->p_uarea; - if (up == 0) { - up = kmem_alloc_nofault(kernel_map, UAREA_PAGES * PAGE_SIZE); - if (up == 0) - panic("pmap_new_proc: upage allocation failed"); - p->p_uarea = (struct user *)up; - } - - for (i = 0; i < UAREA_PAGES; i++) { - /* - * Get a uarea page. - */ - m = vm_page_grab(upobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - ma[i] = m; - - /* - * Wire the page. - */ - m->wire_count++; - cnt.v_wire_count++; - - vm_page_wakeup(m); - vm_page_flag_clear(m, PG_ZERO); - vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE); - m->valid = VM_PAGE_BITS_ALL; - } - - /* - * Enter the pages into the kernel address space. - */ - pmap_qenter(up, ma, UAREA_PAGES); -} - -/* - * Dispose the U area for a process that has exited. - * This routine directly impacts the exit perf of a process. - */ -void -pmap_dispose_proc(struct proc *p) -{ - vm_object_t upobj; - vm_offset_t up; - vm_page_t m; - int i; - - upobj = p->p_upages_obj; - up = (vm_offset_t)p->p_uarea; - for (i = 0; i < UAREA_PAGES; i++) { - m = vm_page_lookup(upobj, i); - if (m == NULL) - panic("pmap_dispose_proc: upage already missing?"); - vm_page_busy(m); - vm_page_unwire(m, 0); - vm_page_free(m); - } - pmap_qremove(up, UAREA_PAGES); - - /* - * If the process got swapped out some of its UPAGES might have gotten - * swapped. Just get rid of the object to clean up the swap use - * proactively. NOTE! might block waiting for paging I/O to complete. - */ - if (upobj->type == OBJT_SWAP) { - p->p_upages_obj = NULL; - vm_object_deallocate(upobj); - } -} - -/* - * Allow the U area for a process to be prejudicially paged out. - */ -void -pmap_swapout_proc(struct proc *p) -{ - vm_object_t upobj; - vm_offset_t up; - vm_page_t m; - int i; - - upobj = p->p_upages_obj; - up = (vm_offset_t)p->p_uarea; - for (i = 0; i < UAREA_PAGES; i++) { - m = vm_page_lookup(upobj, i); - if (m == NULL) - panic("pmap_swapout_proc: upage already missing?"); - vm_page_dirty(m); - vm_page_unwire(m, 0); - } - pmap_qremove(up, UAREA_PAGES); -} - -/* - * Bring the U area for a specified process back in. - */ -void -pmap_swapin_proc(struct proc *p) -{ - vm_page_t ma[UAREA_PAGES]; - vm_object_t upobj; - vm_offset_t up; - vm_page_t m; - int rv; - int i; - - upobj = p->p_upages_obj; - up = (vm_offset_t)p->p_uarea; - for (i = 0; i < UAREA_PAGES; i++) { - m = vm_page_grab(upobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - if (m->valid != VM_PAGE_BITS_ALL) { - rv = vm_pager_get_pages(upobj, &m, 1, 0); - if (rv != VM_PAGER_OK) - panic("pmap_swapin_proc: cannot get upage"); - m = vm_page_lookup(upobj, i); - m->valid = VM_PAGE_BITS_ALL; - } - ma[i] = m; - vm_page_wire(m); - vm_page_wakeup(m); - vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE); - } - pmap_qenter(up, ma, UAREA_PAGES); -} - -/* * Create the KSTACK for a new thread. * This routine directly affects the fork perf for a process/thread. */ |