Release the page queues lock earlier in pmap_protect() and pmap_remove() in

order to reduce contention.
This commit is contained in:
Alan Cox 2004-09-18 22:56:58 +00:00
parent 6e2faf455e
commit 7580b56bdc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135443
3 changed files with 13 additions and 16 deletions

View File

@ -1565,6 +1565,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
if (pmap->pm_stats.resident_count == 0)
return;
anyvalid = 0;
vm_page_lock_queues();
PMAP_LOCK(pmap);
@ -1581,8 +1583,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
}
}
anyvalid = 0;
for (; sva < eva; sva = va_next) {
if (pmap->pm_stats.resident_count == 0)
@ -1644,11 +1644,10 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
break;
}
}
if (anyvalid)
pmap_invalidate_all(pmap);
out:
vm_page_unlock_queues();
if (anyvalid)
pmap_invalidate_all(pmap);
PMAP_UNLOCK(pmap);
}
@ -1818,9 +1817,9 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
}
}
}
vm_page_unlock_queues();
if (anychanged)
pmap_invalidate_all(pmap);
vm_page_unlock_queues();
PMAP_UNLOCK(pmap);
}

View File

@ -1650,6 +1650,8 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
if (pmap->pm_stats.resident_count == 0)
return;
anyvalid = 0;
vm_page_lock_queues();
sched_pin();
PMAP_LOCK(pmap);
@ -1665,8 +1667,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
goto out;
}
anyvalid = 0;
for (; sva < eva; sva = pdnxt) {
unsigned pdirindex;
@ -1714,12 +1714,11 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
break;
}
}
if (anyvalid)
pmap_invalidate_all(pmap);
out:
sched_unpin();
vm_page_unlock_queues();
if (anyvalid)
pmap_invalidate_all(pmap);
PMAP_UNLOCK(pmap);
}
@ -1879,10 +1878,10 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
}
}
}
if (anychanged)
pmap_invalidate_all(pmap);
sched_unpin();
vm_page_unlock_queues();
if (anychanged)
pmap_invalidate_all(pmap);
PMAP_UNLOCK(pmap);
}

View File

@ -1351,11 +1351,10 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
}
}
}
out:
vm_page_unlock_queues();
pmap_install(oldpmap);
PMAP_UNLOCK(pmap);
vm_page_unlock_queues();
}
/*
@ -1468,9 +1467,9 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot)
sva += PAGE_SIZE;
}
vm_page_unlock_queues();
pmap_install(oldpmap);
PMAP_UNLOCK(pmap);
vm_page_unlock_queues();
}
/*