diff options
author | alc <alc@FreeBSD.org> | 2010-05-07 15:49:43 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2010-05-07 15:49:43 +0000 |
commit | 3c8033e013869592babb928a6c8f569b9933f50d (patch) | |
tree | c95d39437ab8d8d820e5bf3ff157c2c97e2cf7d5 /sys/vm | |
parent | c4496831804ff579b314fe34248c4da316de7fb7 (diff) | |
download | FreeBSD-src-3c8033e013869592babb928a6c8f569b9933f50d.zip FreeBSD-src-3c8033e013869592babb928a6c8f569b9933f50d.tar.gz |
Push down the page queues lock into vm_page_activate().
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_fault.c | 7 | ||||
-rw-r--r-- | sys/vm/vm_page.c | 11 | ||||
-rw-r--r-- | sys/vm/vnode_pager.c | 15 |
3 files changed, 17 insertions, 16 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 0088248..05c3228 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -937,7 +937,6 @@ vnode_locked: vm_fault_prefault(fs.map->pmap, vaddr, fs.entry); VM_OBJECT_LOCK(fs.object); vm_page_lock(fs.m); - vm_page_lock_queues(); /* * If the page is not wired down, then put it where the pageout daemon @@ -948,10 +947,8 @@ vnode_locked: vm_page_wire(fs.m); else vm_page_unwire(fs.m, 1); - } else { + } else vm_page_activate(fs.m); - } - vm_page_unlock_queues(); vm_page_unlock(fs.m); vm_page_wakeup(fs.m); @@ -1267,9 +1264,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map, vm_page_unlock(dst_m); } else { vm_page_lock(dst_m); - vm_page_lock_queues(); vm_page_activate(dst_m); - vm_page_unlock_queues(); vm_page_unlock(dst_m); } vm_page_wakeup(dst_m); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index afa5cfb..455c990 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1374,22 +1374,25 @@ vm_page_enqueue(int queue, vm_page_t m) * Ensure that act_count is at least ACT_INIT but do not otherwise * mess with it. * - * The page queues must be locked. + * The page must be locked. * This routine may not block. */ void vm_page_activate(vm_page_t m) { - mtx_assert(&vm_page_queue_mtx, MA_OWNED); vm_page_lock_assert(m, MA_OWNED); if (VM_PAGE_GETKNOWNQUEUE2(m) != PQ_ACTIVE) { - vm_pageq_remove(m); if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; + vm_page_lock_queues(); + vm_pageq_remove(m); vm_page_enqueue(PQ_ACTIVE, m); - } + vm_page_unlock_queues(); + } else + KASSERT(m->queue == PQ_NONE, + ("vm_page_activate: wired page %p is queued", m)); } else { if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 69fd5d1..cfe9f99 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -948,8 +948,6 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage) nextoff = tfoff + PAGE_SIZE; mt = m[i]; - vm_page_lock(mt); - vm_page_lock_queues(); if (nextoff <= object->un_pager.vnp.vnp_size) { /* * Read filled up entire page. @@ -992,17 +990,22 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage) * now tell them that it is ok to use */ if (!error) { - if (mt->oflags & VPO_WANTED) + if (mt->oflags & VPO_WANTED) { + vm_page_lock(mt); vm_page_activate(mt); - else + vm_page_unlock(mt); + } else { + vm_page_lock(mt); vm_page_deactivate(mt); + vm_page_unlock(mt); + } vm_page_wakeup(mt); } else { + vm_page_lock(mt); vm_page_free(mt); + vm_page_unlock(mt); } } - vm_page_unlock_queues(); - vm_page_unlock(mt); } VM_OBJECT_UNLOCK(object); if (error) { |