From 3a757e5403966b1b3f85ec0c598f547c67e0d33f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 24 Oct 2017 17:14:53 +0000 Subject: [PATCH] Micro-optimize the handling of fictitious pages in vm_page_free_prep(). A fictitious page is always wired, so there is no point in trying to remove one from the page queues. Completely remove one inaccurate comment from vm_page_free_prep() and correct another. Reviewed by: kib, markj MFC after: 1 week --- sys/vm/vm_page.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 7311d19da89a..4604a7ebc6b6 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2802,27 +2802,26 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) if (vm_page_sbusied(m)) panic("vm_page_free: freeing busy page %p", m); + vm_page_remove(m); + /* - * Unqueue, then remove page. Note that we cannot destroy - * the page here because we do not want to call the pager's - * callback routine until after we've put the page on the - * appropriate free queue. + * If fictitious remove object association and + * return. */ + if ((m->flags & PG_FICTITIOUS) != 0) { + KASSERT(m->wire_count == 1, + ("fictitious page %p is not wired", m)); + KASSERT(m->queue == PQ_NONE, + ("fictitious page %p is queued", m)); + return (false); + } + if (m->queue != PQ_NONE) { if (pagequeue_locked) vm_page_dequeue_locked(m); else vm_page_dequeue(m); } - vm_page_remove(m); - - /* - * If fictitious remove object association and - * return, otherwise delay object association removal. - */ - if ((m->flags & PG_FICTITIOUS) != 0) - return (false); - m->valid = 0; vm_page_undirty(m);