diff options
-rw-r--r-- | sys/vm/vm_mmap.c | 3 | ||||
-rw-r--r-- | sys/vm/vm_page.c | 27 | ||||
-rw-r--r-- | sys/vm/vm_page.h | 1 |
3 files changed, 31 insertions, 0 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index d9b1516..2588c85 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -888,6 +888,9 @@ RestartScan: pindex = OFF_TO_IDX(current->offset + (addr - current->start)); m = vm_page_lookup(object, pindex); + if (m == NULL && + vm_page_is_cached(object, pindex)) + mincoreinfo = MINCORE_INCORE; if (m != NULL && m->valid == 0) m = NULL; if (m != NULL) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index f83cd90..565ac99 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1285,6 +1285,33 @@ vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart, } /* + * Returns TRUE if a cached page is associated with the given object and + * offset, and FALSE otherwise. + * + * The object must be locked. + */ +boolean_t +vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) +{ + vm_page_t m; + + /* + * Insertion into an object's collection of cached pages requires the + * object to be locked. Therefore, if the object is locked and the + * object's collection is empty, there is no need to acquire the free + * page queues lock in order to prove that the specified page doesn't + * exist. + */ + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + if (object->cache == NULL) + return (FALSE); + mtx_lock(&vm_page_queue_free_mtx); + m = vm_page_cache_lookup(object, pindex); + mtx_unlock(&vm_page_queue_free_mtx); + return (m != NULL); +} + +/* * vm_page_alloc: * * Allocate and return a page that is associated with the specified diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index a5e2523..928db0f 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -392,6 +392,7 @@ void vm_page_deactivate (vm_page_t); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); +boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); vm_page_t vm_page_next(vm_page_t m); int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *); |