1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

MFi386 revision 1.416

Add vm object locking to pmap_prefault().

Note: powerpc and sparc64 do not implement this function.
This commit is contained in:
Alan Cox 2003-07-25 18:58:39 +00:00
parent a564e4a923
commit 059358675e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118024
3 changed files with 30 additions and 21 deletions

View File

@ -2130,7 +2130,7 @@ pmap_prefault(pmap, addra, entry)
mpte = NULL; mpte = NULL;
for (i = 0; i < PAGEORDER_SIZE; i++) { for (i = 0; i < PAGEORDER_SIZE; i++) {
vm_object_t lobject; vm_object_t backing_object, lobject;
pt_entry_t *pte; pt_entry_t *pte;
addr = addra + pmap_prefault_pageorder[i]; addr = addra + pmap_prefault_pageorder[i];
@ -2150,15 +2150,18 @@ pmap_prefault(pmap, addra, entry)
pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT;
lobject = object; lobject = object;
for (m = vm_page_lookup(lobject, pindex); VM_OBJECT_LOCK(lobject);
(!m && (lobject->type == OBJT_DEFAULT) && (lobject->backing_object)); while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
lobject = lobject->backing_object) { lobject->type == OBJT_DEFAULT &&
(backing_object = lobject->backing_object) != NULL) {
if (lobject->backing_object_offset & PAGE_MASK) if (lobject->backing_object_offset & PAGE_MASK)
break; break;
pindex += (lobject->backing_object_offset >> PAGE_SHIFT); pindex += lobject->backing_object_offset >> PAGE_SHIFT;
m = vm_page_lookup(lobject->backing_object, pindex); VM_OBJECT_LOCK(backing_object);
VM_OBJECT_UNLOCK(lobject);
lobject = backing_object;
} }
VM_OBJECT_UNLOCK(lobject);
/* /*
* give-up when a page is not in memory * give-up when a page is not in memory
*/ */

View File

@ -2176,7 +2176,7 @@ pmap_prefault(pmap, addra, entry)
mpte = NULL; mpte = NULL;
for (i = 0; i < PAGEORDER_SIZE; i++) { for (i = 0; i < PAGEORDER_SIZE; i++) {
vm_object_t lobject; vm_object_t backing_object, lobject;
pt_entry_t *pte; pt_entry_t *pte;
addr = addra + pmap_prefault_pageorder[i]; addr = addra + pmap_prefault_pageorder[i];
@ -2196,15 +2196,18 @@ pmap_prefault(pmap, addra, entry)
pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT;
lobject = object; lobject = object;
for (m = vm_page_lookup(lobject, pindex); VM_OBJECT_LOCK(lobject);
(!m && (lobject->type == OBJT_DEFAULT) && (lobject->backing_object)); while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
lobject = lobject->backing_object) { lobject->type == OBJT_DEFAULT &&
(backing_object = lobject->backing_object) != NULL) {
if (lobject->backing_object_offset & PAGE_MASK) if (lobject->backing_object_offset & PAGE_MASK)
break; break;
pindex += (lobject->backing_object_offset >> PAGE_SHIFT); pindex += lobject->backing_object_offset >> PAGE_SHIFT;
m = vm_page_lookup(lobject->backing_object, pindex); VM_OBJECT_LOCK(backing_object);
VM_OBJECT_UNLOCK(lobject);
lobject = backing_object;
} }
VM_OBJECT_UNLOCK(lobject);
/* /*
* give-up when a page is not in memory * give-up when a page is not in memory
*/ */

View File

@ -1811,7 +1811,7 @@ pmap_prefault(pmap, addra, entry)
mpte = NULL; mpte = NULL;
for (i = 0; i < PAGEORDER_SIZE; i++) { for (i = 0; i < PAGEORDER_SIZE; i++) {
vm_object_t lobject; vm_object_t backing_object, lobject;
struct ia64_lpte *pte; struct ia64_lpte *pte;
addr = addra + pmap_prefault_pageorder[i]; addr = addra + pmap_prefault_pageorder[i];
@ -1827,15 +1827,18 @@ pmap_prefault(pmap, addra, entry)
pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT;
lobject = object; lobject = object;
for (m = vm_page_lookup(lobject, pindex); VM_OBJECT_LOCK(lobject);
(!m && (lobject->type == OBJT_DEFAULT) && (lobject->backing_object)); while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
lobject = lobject->backing_object) { lobject->type == OBJT_DEFAULT &&
(backing_object = lobject->backing_object) != NULL) {
if (lobject->backing_object_offset & PAGE_MASK) if (lobject->backing_object_offset & PAGE_MASK)
break; break;
pindex += (lobject->backing_object_offset >> PAGE_SHIFT); pindex += lobject->backing_object_offset >> PAGE_SHIFT;
m = vm_page_lookup(lobject->backing_object, pindex); VM_OBJECT_LOCK(backing_object);
VM_OBJECT_UNLOCK(lobject);
lobject = backing_object;
} }
VM_OBJECT_UNLOCK(lobject);
/* /*
* give-up when a page is not in memory * give-up when a page is not in memory
*/ */