From 6ea6d75bcde3efd8e7178a98e5b20456afe66a4c Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 9 Mar 2016 17:51:24 -0800 Subject: [PATCH 10/16] Remove PG_CACHED. --- sys/vm/vm_page.c | 49 ++++++------------------------------------------- sys/vm/vm_page.h | 1 - sys/vm/vm_phys.c | 2 +- 3 files changed, 7 insertions(+), 45 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 626fd96..7d964e9 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1061,8 +1061,6 @@ vm_page_dirty_KBI(vm_page_t m) { /* These assertions refer to this operation by its public name. */ - KASSERT((m->flags & PG_CACHED) == 0, - ("vm_page_dirty: page in cache!")); KASSERT(m->valid == VM_PAGE_BITS_ALL, ("vm_page_dirty: page is invalid!")); m->dirty = VM_PAGE_BITS_ALL; @@ -1971,40 +1969,12 @@ retry: KASSERT((m->flags & PG_UNHOLDFREE) == 0, ("page %p is PG_UNHOLDFREE", m)); /* Don't care: PG_NODUMP, PG_WINATCFLS, PG_ZERO. */ + KASSERT(m == vm_page_lookup(object, m->pindex), + ("page %p not resident in %p", m, object)); if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && - object->type != OBJT_VNODE) + object->type != OBJT_VNODE) { run_ext = 0; - else if ((m->flags & PG_CACHED) != 0 || - m != vm_page_lookup(object, m->pindex)) { - /* - * The page is cached or recently converted - * from cached to free. - */ -#if VM_NRESERVLEVEL > 0 - if (level >= 0) { - /* - * The page is reserved. Extend the - * current run by one page. - */ - run_ext = 1; - } else -#endif - if ((order = m->order) < VM_NFREEORDER) { - /* - * The page is enqueued in the - * physical memory allocator's cache/ - * free page queues. Moreover, it is - * the first page in a power-of-two- - * sized run of contiguous cache/free - * pages. Add these pages to the end - * of the current run, and jump - * ahead. - */ - run_ext = 1 << order; - m_inc = 1 << order; - } else - run_ext = 0; #if VM_NRESERVLEVEL > 0 } else if ((options & VPSC_NOSUPER) != 0 && (level = vm_reserv_level_iffullpop(m)) >= 0) { @@ -2167,19 +2137,13 @@ retry: KASSERT((m->flags & PG_UNHOLDFREE) == 0, ("page %p is PG_UNHOLDFREE", m)); /* Don't care: PG_NODUMP, PG_WINATCFLS, PG_ZERO. */ + KASSERT(m == vm_page_lookup(object, m->pindex), + ("page %p not resident in %p", m, object)); if (object->type != OBJT_DEFAULT && object->type != OBJT_SWAP && object->type != OBJT_VNODE) error = EINVAL; - else if ((m->flags & PG_CACHED) != 0 || - m != vm_page_lookup(object, m->pindex)) { - /* - * The page is cached or recently converted - * from cached to free. - */ - VM_OBJECT_WUNLOCK(object); - goto cached; - } else if (object->memattr != VM_MEMATTR_DEFAULT) + else if (object->memattr != VM_MEMATTR_DEFAULT) error = EINVAL; else if (m->queue != PQ_NONE && !vm_page_busied(m)) { KASSERT(pmap_page_get_memattr(m) == @@ -2280,7 +2244,6 @@ retry: unlock: VM_OBJECT_WUNLOCK(object); } else { -cached: mtx_lock(&vm_page_queue_free_mtx); order = m->order; if (order < VM_NFREEORDER) { diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index d0161fd..5d45a50 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -326,7 +326,6 @@ extern struct mtx_padalign pa_lock[]; * Page flags. If changed at any other time than page allocation or * freeing, the modification must be protected by the vm_page lock. */ -#define PG_CACHED 0x0001 /* page is cached */ #define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */ #define PG_ZERO 0x0008 /* page is zeroed */ #define PG_MARKER 0x0010 /* special queue marker page */ diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 3979513..f6f542f 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -1309,7 +1309,7 @@ vm_phys_zero_pages_idle(void) for (;;) { TAILQ_FOREACH_REVERSE(m, &fl[oind].pl, pglist, plinks.q) { for (m_tmp = m; m_tmp < &m[1 << oind]; m_tmp++) { - if ((m_tmp->flags & (PG_CACHED | PG_ZERO)) == 0) { + if ((m_tmp->flags & PG_ZERO) == 0) { vm_phys_unfree_page(m_tmp); vm_phys_freecnt_adj(m, -1); mtx_unlock(&vm_page_queue_free_mtx); -- 2.8.1