summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_anon.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-04-13 18:57:50 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-04-13 18:57:50 +0000
commit8dcbe71580f80a022d075e6454486bc9d964c765 (patch)
treea758a75bd2f6e39d8ea45545b501abbee0430ef1 /sys/uvm/uvm_anon.c
parent977eb8538189c8e232f80c85b5a0416ec6cd3670 (diff)
While splitting flags and pqflags might have been a good idea in theory
to separate locking, on most modern machines this is not enough since operations on short types touch other short types that share the same word in memory. Merge pg_flags and pqflags again and now use atomic operations to change the flags. Also bump wire_count to an int and pg_version might go int as well, just for alignment. tested by many, many. ok miod@
Diffstat (limited to 'sys/uvm/uvm_anon.c')
-rw-r--r--sys/uvm/uvm_anon.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c
index 6da4ac1979e..47a8b81caf1 100644
--- a/sys/uvm/uvm_anon.c
+++ b/sys/uvm/uvm_anon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_anon.c,v 1.26 2007/04/04 17:44:45 art Exp $ */
+/* $OpenBSD: uvm_anon.c,v 1.27 2007/04/13 18:57:49 art Exp $ */
/* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -233,7 +233,7 @@ uvm_anfree(anon)
if ((pg->pg_flags & PG_BUSY) != 0) {
/* tell them to dump it when done */
- pg->pg_flags |= PG_RELEASED;
+ atomic_setbits_int(&pg->pg_flags, PG_RELEASED);
UVMHIST_LOG(maphist,
" anon %p, page %p: BUSY (released!)",
anon, pg, 0, 0);
@@ -371,9 +371,9 @@ uvm_anon_lockloanpg(anon)
* then we can take over as owner!
*/
- if (pg->uobject == NULL && (pg->pqflags & PQ_ANON) == 0) {
+ if (pg->uobject == NULL && (pg->pg_flags & PQ_ANON) == 0) {
uvm_lock_pageq();
- pg->pqflags |= PQ_ANON; /* take ownership... */
+ atomic_setbits_int(&pg->pg_flags, PQ_ANON);
pg->loan_count--; /* ... and drop our loan */
uvm_unlock_pageq();
}
@@ -508,16 +508,14 @@ anon_pagein(anon)
uobj = pg->uobject;
uvm_swap_free(anon->an_swslot, 1);
anon->an_swslot = 0;
- pg->pg_flags &= ~(PG_CLEAN);
+ atomic_clearbits_int(&pg->pg_flags, PG_CLEAN);
/*
* deactivate the page (to put it on a page queue)
*/
pmap_clear_reference(pg);
-#ifndef UBC
pmap_page_protect(pg, VM_PROT_NONE);
-#endif
uvm_lock_pageq();
uvm_pagedeactivate(pg);
uvm_unlock_pageq();