From 14f8ceaa07996ddef0959aeb8838fe697be940a7 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 29 Jul 2002 05:42:44 +0000 Subject: [PATCH] o Pass VM_ALLOC_WIRED to vm_page_grab() rather than calling vm_page_wire() in pmap_new_thread(), pmap_pinit(), and vm_proc_new(). o Lock page queue accesses by vm_page_free() in pmap_object_init_pt(). --- sys/amd64/amd64/pmap.c | 18 +++++------------- sys/i386/i386/pmap.c | 18 +++++------------- sys/vm/vm_glue.c | 9 ++------- 3 files changed, 12 insertions(+), 33 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 13c3c7ddd179..612d9474c253 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -974,15 +974,10 @@ pmap_new_thread(struct thread *td) /* * Get a kernel stack page */ - m = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(ksobj, i, + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); 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); @@ -1222,12 +1217,7 @@ pmap_pinit(pmap) * allocate the page directory page */ ptdpg = vm_page_grab(pmap->pm_pteobj, PTDPTDI, - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - - ptdpg->wire_count = 1; - ++cnt.v_wire_count; - - + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); vm_page_flag_clear(ptdpg, PG_MAPPED | PG_BUSY); /* not usually mapped*/ ptdpg->valid = VM_PAGE_BITS_ALL; @@ -2347,7 +2337,9 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, m[0] = p; if (vm_pager_get_pages(object, m, 1, 0) != VM_PAGER_OK) { + vm_page_lock_queues(); vm_page_free(p); + vm_page_unlock_queues(); return; } diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 13c3c7ddd179..612d9474c253 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -974,15 +974,10 @@ pmap_new_thread(struct thread *td) /* * Get a kernel stack page */ - m = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(ksobj, i, + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); 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); @@ -1222,12 +1217,7 @@ pmap_pinit(pmap) * allocate the page directory page */ ptdpg = vm_page_grab(pmap->pm_pteobj, PTDPTDI, - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); - - ptdpg->wire_count = 1; - ++cnt.v_wire_count; - - + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); vm_page_flag_clear(ptdpg, PG_MAPPED | PG_BUSY); /* not usually mapped*/ ptdpg->valid = VM_PAGE_BITS_ALL; @@ -2347,7 +2337,9 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, m[0] = p; if (vm_pager_get_pages(object, m, 1, 0) != VM_PAGER_OK) { + vm_page_lock_queues(); vm_page_free(p); + vm_page_unlock_queues(); return; } diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 36f709de3437..ca1d582b9e30 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -230,15 +230,10 @@ vm_proc_new(struct proc *p) /* * Get a uarea page. */ - m = vm_page_grab(upobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(upobj, i, + VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED); 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);