Fix mincore(2) so that it reports PG_CACHED pages as resident.
MFC after: 2 weeks
This commit is contained in:
parent
908e3da10e
commit
1c8279e4e7
@ -888,6 +888,9 @@ sys_mincore(td, uap)
|
||||
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)
|
||||
|
@ -1284,6 +1284,33 @@ vm_page_cache_transfer(vm_object_t orig_object, vm_pindex_t offidxstart,
|
||||
mtx_unlock(&vm_page_queue_free_mtx);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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:
|
||||
*
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user