From 9a989d9b4453af27b684155b122a09ee340ba64f Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 4 Mar 2016 23:07:50 -0800 Subject: [PATCH 01/16] Remove VM_ALLOC_IFNOTCACHED and VM_ALLOC_IFCACHED. PG_CACHE pages cannot be created. Therefore, they cannot be returned. --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 4 ---- sys/kern/kern_exec.c | 2 +- sys/vm/vm_object.c | 7 ------- sys/vm/vm_page.c | 10 ---------- sys/vm/vm_page.h | 4 ++-- sys/vm/vnode_pager.c | 6 ++---- 6 files changed, 5 insertions(+), 28 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 9df85a7..cedd11a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -427,10 +427,6 @@ page_busy(vnode_t *vp, int64_t start, int64_t off, int64_t nbytes) continue; } vm_page_sbusy(pp); - } else if (pp == NULL) { - pp = vm_page_alloc(obj, OFF_TO_IDX(start), - VM_ALLOC_SYSTEM | VM_ALLOC_IFCACHED | - VM_ALLOC_SBUSY); } else { ASSERT(pp != NULL && !pp->valid); pp = NULL; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 69f0774..bb85c4a 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -986,7 +986,7 @@ exec_map_first_page(imgp) break; } else { ma[i] = vm_page_alloc(object, i, - VM_ALLOC_NORMAL | VM_ALLOC_IFNOTCACHED); + VM_ALLOC_NORMAL); if (ma[i] == NULL) break; } diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index c0b30eb..0ef721d 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1131,13 +1131,6 @@ shadowlookup: } else if ((tobject->flags & OBJ_UNMANAGED) != 0) goto unlock_tobject; m = vm_page_lookup(tobject, tpindex); - if (m == NULL && advise == MADV_WILLNEED) { - /* - * If the page is cached, reactivate it. - */ - m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | - VM_ALLOC_NOBUSY); - } if (m == NULL) { /* * There may be swap even if there is no backing page diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 54270f6..c8fd4ef 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1568,9 +1568,6 @@ vm_page_is_cached(vm_object_t object, vm_pindex_t pindex) * optional allocation flags: * VM_ALLOC_COUNT(number) the number of additional pages that the caller * intends to allocate - * VM_ALLOC_IFCACHED return page only if it is cached - * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page - * is cached * VM_ALLOC_NOBUSY do not exclusive busy the page * VM_ALLOC_NODUMP do not include the page in a kernel core dump * VM_ALLOC_NOOBJ page is not associated with an object and @@ -1630,10 +1627,6 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) */ if (object != NULL && (m = vm_page_cache_lookup(object, pindex)) != NULL) { - if ((req & VM_ALLOC_IFNOTCACHED) != 0) { - mtx_unlock(&vm_page_queue_free_mtx); - return (NULL); - } if (vm_phys_unfree_page(m)) vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, 0); #if VM_NRESERVLEVEL > 0 @@ -1643,9 +1636,6 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) #endif panic("vm_page_alloc: cache page %p is missing" " from the free queue", m); - } else if ((req & VM_ALLOC_IFCACHED) != 0) { - mtx_unlock(&vm_page_queue_free_mtx); - return (NULL); #if VM_NRESERVLEVEL > 0 } else if (object == NULL || (object->flags & (OBJ_COLORED | OBJ_FICTITIOUS)) != OBJ_COLORED || (m = diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index c41104c..d0161fd 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -409,8 +409,8 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); #define VM_ALLOC_ZERO 0x0040 /* (acfg) Try to obtain a zeroed page */ #define VM_ALLOC_NOOBJ 0x0100 /* (acg) No associated object */ #define VM_ALLOC_NOBUSY 0x0200 /* (acg) Do not busy the page */ -#define VM_ALLOC_IFCACHED 0x0400 /* (ag) Fail if page is not cached */ -#define VM_ALLOC_IFNOTCACHED 0x0800 /* (ag) Fail if page is cached */ +#define VM_ALLOC_UNUSED0 0x0400 +#define VM_ALLOC_UNUSED1 0x0800 #define VM_ALLOC_IGN_SBUSY 0x1000 /* (g) Ignore shared busy flag */ #define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */ #define VM_ALLOC_SBUSY 0x4000 /* (acg) Shared busy the page */ diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index 66dd29d..ab7e3b4 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -882,8 +882,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, for (tpindex = m[0]->pindex - 1; tpindex >= startpindex && tpindex < m[0]->pindex; tpindex--, i++) { - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | - VM_ALLOC_IFNOTCACHED); + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); if (p == NULL) { /* Shift the array. */ for (int j = 0; j < i; j++) @@ -920,8 +919,7 @@ vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m, int count, for (tpindex = m[count - 1]->pindex + 1; tpindex < endpindex; i++, tpindex++) { - p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL | - VM_ALLOC_IFNOTCACHED); + p = vm_page_alloc(object, tpindex, VM_ALLOC_NORMAL); if (p == NULL) break; bp->b_pages[i] = p; -- 2.8.1