summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-08-12 18:40:18 +0000
committeralc <alc@FreeBSD.org>2002-08-12 18:40:18 +0000
commit39fe3312e6b2bb7959a26b4fbafeedb77c088990 (patch)
tree954c5878afa0e69681c05d74637e905cef25a5dc
parent9635a819406308510af37add7d7467bc4430bc09 (diff)
downloadFreeBSD-src-39fe3312e6b2bb7959a26b4fbafeedb77c088990.zip
FreeBSD-src-39fe3312e6b2bb7959a26b4fbafeedb77c088990.tar.gz
o Convert three instances of vm_page_sleep_busy() into vm_page_sleep_if_busy()
with page queue locking.
-rw-r--r--sys/amd64/amd64/pmap.c24
-rw-r--r--sys/i386/i386/pmap.c24
2 files changed, 30 insertions, 18 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6aa0475..4c52982 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -925,8 +925,12 @@ pmap_page_lookup(vm_object_t object, vm_pindex_t pindex)
retry:
m = vm_page_lookup(object, pindex);
- if (m && vm_page_sleep_busy(m, FALSE, "pplookp"))
- goto retry;
+ if (m != NULL) {
+ vm_page_lock_queues();
+ if (vm_page_sleep_if_busy(m, FALSE, "pplookp"))
+ goto retry;
+ vm_page_unlock_queues();
+ }
return m;
}
@@ -1258,15 +1262,15 @@ static int
pmap_release_free_page(pmap_t pmap, vm_page_t p)
{
pd_entry_t *pde = pmap->pm_pdir;
+
/*
* This code optimizes the case of freeing non-busy
* page-table pages. Those pages are zero now, and
* might as well be placed directly into the zero queue.
*/
- if (vm_page_sleep_busy(p, FALSE, "pmaprl"))
- return 0;
-
vm_page_lock_queues();
+ if (vm_page_sleep_if_busy(p, FALSE, "pmaprl"))
+ return (0);
vm_page_busy(p);
/*
@@ -2322,10 +2326,12 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
retry:
p = vm_page_lookup(object, pindex);
- if (p && vm_page_sleep_busy(p, FALSE, "init4p"))
- goto retry;
-
- if (p == NULL) {
+ if (p != NULL) {
+ vm_page_lock_queues();
+ if (vm_page_sleep_if_busy(p, FALSE, "init4p"))
+ goto retry;
+ vm_page_unlock_queues();
+ } else {
p = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
if (p == NULL)
return;
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 6aa0475..4c52982 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -925,8 +925,12 @@ pmap_page_lookup(vm_object_t object, vm_pindex_t pindex)
retry:
m = vm_page_lookup(object, pindex);
- if (m && vm_page_sleep_busy(m, FALSE, "pplookp"))
- goto retry;
+ if (m != NULL) {
+ vm_page_lock_queues();
+ if (vm_page_sleep_if_busy(m, FALSE, "pplookp"))
+ goto retry;
+ vm_page_unlock_queues();
+ }
return m;
}
@@ -1258,15 +1262,15 @@ static int
pmap_release_free_page(pmap_t pmap, vm_page_t p)
{
pd_entry_t *pde = pmap->pm_pdir;
+
/*
* This code optimizes the case of freeing non-busy
* page-table pages. Those pages are zero now, and
* might as well be placed directly into the zero queue.
*/
- if (vm_page_sleep_busy(p, FALSE, "pmaprl"))
- return 0;
-
vm_page_lock_queues();
+ if (vm_page_sleep_if_busy(p, FALSE, "pmaprl"))
+ return (0);
vm_page_busy(p);
/*
@@ -2322,10 +2326,12 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
retry:
p = vm_page_lookup(object, pindex);
- if (p && vm_page_sleep_busy(p, FALSE, "init4p"))
- goto retry;
-
- if (p == NULL) {
+ if (p != NULL) {
+ vm_page_lock_queues();
+ if (vm_page_sleep_if_busy(p, FALSE, "init4p"))
+ goto retry;
+ vm_page_unlock_queues();
+ } else {
p = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL);
if (p == NULL)
return;
OpenPOWER on IntegriCloud