summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_amap.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-11-07 02:55:52 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-11-07 02:55:52 +0000
commitcc211db56384036a7e588d635b51f11a921dd54e (patch)
tree901408843f90b295b4287da701ff27afbb5c876c /sys/uvm/uvm_amap.c
parent253f31ab10d5b90c1d64de9c7dec0385fa0c9f7c (diff)
Another sync of uvm to NetBSD. Just minor fiddling, no major changes.
Diffstat (limited to 'sys/uvm/uvm_amap.c')
-rw-r--r--sys/uvm/uvm_amap.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c
index 800a0dec20c..b0e1e040488 100644
--- a/sys/uvm/uvm_amap.c
+++ b/sys/uvm/uvm_amap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: uvm_amap.c,v 1.13 2001/11/06 13:36:52 art Exp $ */
-/* $NetBSD: uvm_amap.c,v 1.26 2000/08/03 00:47:02 thorpej Exp $ */
+/* $OpenBSD: uvm_amap.c,v 1.14 2001/11/07 02:55:50 art Exp $ */
+/* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */
/*
*
@@ -48,6 +48,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/malloc.h>
+#include <sys/kernel.h>
#include <sys/pool.h>
#define UVM_AMAP_C /* ensure disabled inlines are in */
@@ -321,7 +322,7 @@ amap_extend(entry, addsize)
if (amap->am_nslot >= slotneed) {
#ifdef UVM_AMAP_PPREF
if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
- amap_pp_adjref(amap, slotoff + slotmapped, addsize, 1);
+ amap_pp_adjref(amap, slotoff + slotmapped, slotadd, 1);
}
#endif
amap_unlock(amap);
@@ -339,8 +340,8 @@ amap_extend(entry, addsize)
if (amap->am_ppref && amap->am_ppref != PPREF_NONE) {
if ((slotoff + slotmapped) < amap->am_nslot)
amap_pp_adjref(amap, slotoff + slotmapped,
- (amap->am_nslot - (slotoff + slotmapped)) <<
- PAGE_SHIFT, 1);
+ (amap->am_nslot - (slotoff + slotmapped)),
+ 1);
pp_setreflen(amap->am_ppref, amap->am_nslot, 1,
slotneed - amap->am_nslot);
}
@@ -418,8 +419,7 @@ amap_extend(entry, addsize)
amap->am_ppref = newppref;
if ((slotoff + slotmapped) < amap->am_nslot)
amap_pp_adjref(amap, slotoff + slotmapped,
- (amap->am_nslot - (slotoff + slotmapped)) <<
- PAGE_SHIFT, 1);
+ (amap->am_nslot - (slotoff + slotmapped)), 1);
pp_setreflen(newppref, amap->am_nslot, 1, slotadded);
}
#endif
@@ -567,7 +567,8 @@ amap_copy(map, entry, waitf, canchunk, startva, endva)
int slots, lcv;
vaddr_t chunksize;
UVMHIST_FUNC("amap_copy"); UVMHIST_CALLED(maphist);
- UVMHIST_LOG(maphist, " (map=%p, entry=%p, waitf=%d)", map, entry, waitf, 0);
+ UVMHIST_LOG(maphist, " (map=%p, entry=%p, waitf=%d)",
+ map, entry, waitf, 0);
/*
* is there a map to copy? if not, create one from scratch.
@@ -685,7 +686,7 @@ amap_copy(map, entry, waitf, canchunk, startva, endva)
#ifdef UVM_AMAP_PPREF
if (srcamap->am_ppref && srcamap->am_ppref != PPREF_NONE) {
amap_pp_adjref(srcamap, entry->aref.ar_pageoff,
- entry->end - entry->start, -1);
+ (entry->end - entry->start) >> PAGE_SHIFT, -1);
}
#endif
@@ -803,8 +804,10 @@ ReStart:
* XXXCDC: we should cause fork to fail, but
* we can't ...
*/
- if (nanon)
+ if (nanon) {
+ simple_lock(&nanon->an_lock);
uvm_anfree(nanon);
+ }
simple_unlock(&anon->an_lock);
amap_unlock(amap);
uvm_wait("cownowpage");
@@ -854,7 +857,6 @@ amap_splitref(origref, splitref, offset)
vaddr_t offset;
{
int leftslots;
- UVMHIST_FUNC("amap_splitref"); UVMHIST_CALLED(maphist);
AMAP_B2SLOT(leftslots, offset);
if (leftslots == 0)
@@ -926,21 +928,20 @@ amap_pp_establish(amap)
* => caller must check that ppref != PPREF_NONE before calling
*/
void
-amap_pp_adjref(amap, curslot, bytelen, adjval)
+amap_pp_adjref(amap, curslot, slotlen, adjval)
struct vm_amap *amap;
int curslot;
- vsize_t bytelen;
+ vsize_t slotlen;
int adjval;
{
- int slots, stopslot, *ppref, lcv;
+ int stopslot, *ppref, lcv;
int ref, len;
/*
* get init values
*/
- AMAP_B2SLOT(slots, bytelen);
- stopslot = curslot + slots;
+ stopslot = curslot + slotlen;
ppref = amap->am_ppref;
/*
@@ -995,7 +996,6 @@ amap_wiperange(amap, slotoff, slots)
{
int byanon, lcv, stop, curslot, ptr;
struct vm_anon *anon;
- UVMHIST_FUNC("amap_wiperange"); UVMHIST_CALLED(maphist);
/*
* we can either traverse the amap by am_anon or by am_slots depending