diff options
author | alc <alc@FreeBSD.org> | 2003-06-11 06:43:48 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-06-11 06:43:48 +0000 |
commit | 958ca4b21494ab789079b5c875165344ec5ff356 (patch) | |
tree | aa78a33ca8f4ed1d78cdb8a69fe522af2a6fb32a /sys | |
parent | 057b61aa1ca4ab4f1234f96ca5b7b913d408beda (diff) | |
download | FreeBSD-src-958ca4b21494ab789079b5c875165344ec5ff356.zip FreeBSD-src-958ca4b21494ab789079b5c875165344ec5ff356.tar.gz |
Add vm object locking.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sys_process.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 89bd35b..370b757 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -149,7 +149,7 @@ proc_rwmem(struct proc *p, struct uio *uio) { struct vmspace *vm; vm_map_t map; - vm_object_t object = NULL; + vm_object_t backing_object, object = NULL; vm_offset_t pageno = 0; /* page number */ vm_prot_t reqprot; vm_offset_t kva; @@ -239,19 +239,19 @@ proc_rwmem(struct proc *p, struct uio *uio) break; } - - m = vm_page_lookup(object, pindex); - - /* Allow fallback to backing objects if we are reading */ - - while (m == NULL && !writing && object->backing_object) { - + VM_OBJECT_LOCK(object); + while ((m = vm_page_lookup(object, pindex)) == NULL && + !writing && + (backing_object = object->backing_object) != NULL) { + /* + * Allow fallback to backing objects if we are reading. + */ + VM_OBJECT_LOCK(backing_object); pindex += OFF_TO_IDX(object->backing_object_offset); - object = object->backing_object; - - m = vm_page_lookup(object, pindex); + VM_OBJECT_UNLOCK(object); + object = backing_object; } - + VM_OBJECT_UNLOCK(object); if (m == NULL) { error = EFAULT; |