reduce the number of atomic ops in common cases. it's exceptional for

anons to remain longer than amap.
This commit is contained in:
yamt 2011-07-05 13:47:24 +00:00
parent 7d2aeb8d2a
commit 7eec89b991
3 changed files with 7 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_amap.c,v 1.100 2011/06/27 15:56:36 hannken Exp $ */
/* $NetBSD: uvm_amap.c,v 1.101 2011/07/05 13:47:24 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.100 2011/06/27 15:56:36 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.101 2011/07/05 13:47:24 yamt Exp $");
#include "opt_uvmhist.h"
@ -1060,7 +1060,6 @@ ReStart:
*/
nanon->an_lock = amap->am_lock;
mutex_obj_hold(nanon->an_lock);
uvm_pagecopy(pg, npg);
anon->an_ref--;
KASSERT(anon->an_ref > 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_anon.c,v 1.57 2011/06/24 01:39:22 rmind Exp $ */
/* $NetBSD: uvm_anon.c,v 1.58 2011/07/05 13:47:24 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.57 2011/06/24 01:39:22 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_anon.c,v 1.58 2011/07/05 13:47:24 yamt Exp $");
#include "opt_uvmhist.h"
@ -158,6 +158,7 @@ uvm_anfree1(struct vm_anon *anon)
if (pg->flags & PG_BUSY) {
pg->flags |= PG_RELEASED;
mutex_obj_hold(anon->an_lock);
return;
}
mutex_enter(&uvm_pageqlock);
@ -191,9 +192,6 @@ uvm_anfree1(struct vm_anon *anon)
KASSERT(anon->an_swslot == 0);
#endif
if (anon->an_lock != NULL) {
mutex_obj_free(anon->an_lock);
}
pool_cache_put(&uvm_anon_cache, anon);
UVMHIST_LOG(maphist,"<- done!",0,0,0,0);
}
@ -422,7 +420,6 @@ uvm_anon_release(struct vm_anon *anon)
KASSERT(anon->an_page == NULL);
mutex_obj_hold(lock);
uvm_anfree(anon);
mutex_exit(lock);
mutex_obj_free(lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_fault.c,v 1.188 2011/06/24 01:39:22 rmind Exp $ */
/* $NetBSD: uvm_fault.c,v 1.189 2011/07/05 13:47:24 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.188 2011/06/24 01:39:22 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.189 2011/07/05 13:47:24 yamt Exp $");
#include "opt_uvmhist.h"
@ -614,11 +614,9 @@ uvmfault_promote(struct uvm_faultinfo *ufi,
KASSERT(anon->an_lock == NULL);
anon->an_lock = amap->am_lock;
mutex_obj_hold(anon->an_lock);
pg = uvm_pagealloc(NULL, ufi->orig_rvaddr, anon,
UVM_FLAG_COLORMATCH | (opg == NULL ? UVM_PGA_ZERO : 0));
if (pg == NULL) {
mutex_obj_free(anon->an_lock);
anon->an_lock = NULL;
}
} else {