Date: Thu, 19 Oct 2017 04:13:48 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324743 - head/sys/vm Message-ID: <201710190413.v9J4DmCe025804@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Thu Oct 19 04:13:47 2017 New Revision: 324743 URL: https://svnweb.freebsd.org/changeset/base/324743 Log: Batch atomic updates to the number of active, inactive, and laundry pages by vm_object_terminate_pages(). For example, for a "buildworld" workload, this batching reduces vm_object_terminate_pages()'s average execution time by 12%. (The total savings were about 11.7 billion processor cycles.) Reviewed by: kib MFC after: 1 week Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu Oct 19 03:38:53 2017 (r324742) +++ head/sys/vm/vm_object.c Thu Oct 19 04:13:47 2017 (r324743) @@ -715,6 +715,7 @@ vm_object_terminate_pages(vm_object_t object) vm_page_t p, p_next; struct mtx *mtx, *mtx1; struct vm_pagequeue *pq, *pq1; + int dequeued; VM_OBJECT_ASSERT_WLOCKED(object); @@ -739,6 +740,7 @@ vm_object_terminate_pages(vm_object_t object) if (mtx != NULL) mtx_unlock(mtx); if (pq != NULL) { + vm_pagequeue_cnt_add(pq, dequeued); vm_pagequeue_unlock(pq); pq = NULL; } @@ -756,19 +758,27 @@ vm_object_terminate_pages(vm_object_t object) "page %p is not queued", p)); pq1 = vm_page_pagequeue(p); if (pq != pq1) { - if (pq != NULL) + if (pq != NULL) { + vm_pagequeue_cnt_add(pq, dequeued); vm_pagequeue_unlock(pq); + } pq = pq1; vm_pagequeue_lock(pq); + dequeued = 0; } + p->queue = PQ_NONE; + TAILQ_REMOVE(&pq->pq_pl, p, plinks.q); + dequeued--; } if (vm_page_free_prep(p, true)) continue; unlist: TAILQ_REMOVE(&object->memq, p, listq); } - if (pq != NULL) + if (pq != NULL) { + vm_pagequeue_cnt_add(pq, dequeued); vm_pagequeue_unlock(pq); + } if (mtx != NULL) mtx_unlock(mtx);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710190413.v9J4DmCe025804>