From owner-svn-src-head@freebsd.org Thu Aug 23 21:03:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C58B10987D2; Thu, 23 Aug 2018 21:03:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C384D884E0; Thu, 23 Aug 2018 21:03:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EF4C27792; Thu, 23 Aug 2018 21:03:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7NL3ksl062346; Thu, 23 Aug 2018 21:03:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7NL3jEO062343; Thu, 23 Aug 2018 21:03:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201808232103.w7NL3jEO062343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 23 Aug 2018 21:03:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338278 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 338278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2018 21:03:47 -0000 Author: markj Date: Thu Aug 23 21:03:45 2018 New Revision: 338278 URL: https://svnweb.freebsd.org/changeset/base/338278 Log: Add a per-pagequeue pdpages counter. Expose these counters under the vm.domain sysctl node. The existing vm.stats.vm.v_pdpages sysctl is preserved. Reviewed by: alc (previous version) Differential Revision: https://reviews.freebsd.org/D14666 Modified: head/sys/vm/vm_meter.c head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pagequeue.h Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Thu Aug 23 20:44:26 2018 (r338277) +++ head/sys/vm/vm_meter.c Thu Aug 23 21:03:45 2018 (r338278) @@ -364,7 +364,6 @@ VM_STATS_VM(v_vnodepgsout, "Vnode pages paged out"); VM_STATS_VM(v_intrans, "In transit page faults"); VM_STATS_VM(v_reactivated, "Pages reactivated by pagedaemon"); VM_STATS_VM(v_pdwakeups, "Pagedaemon wakeups"); -VM_STATS_VM(v_pdpages, "Pages analyzed by pagedaemon"); VM_STATS_VM(v_pdshortfalls, "Page reclamation shortfalls"); VM_STATS_VM(v_dfree, "Pages freed by pagedaemon"); VM_STATS_VM(v_pfree, "Pages freed by exiting processes"); @@ -436,8 +435,7 @@ vm_free_count(void) return (v); } -static -u_int +static u_int vm_pagequeue_count(int pq) { u_int v; @@ -454,23 +452,42 @@ u_int vm_active_count(void) { - return vm_pagequeue_count(PQ_ACTIVE); + return (vm_pagequeue_count(PQ_ACTIVE)); } u_int vm_inactive_count(void) { - return vm_pagequeue_count(PQ_INACTIVE); + return (vm_pagequeue_count(PQ_INACTIVE)); } u_int vm_laundry_count(void) { - return vm_pagequeue_count(PQ_LAUNDRY); + return (vm_pagequeue_count(PQ_LAUNDRY)); } +static int +sysctl_vm_pdpages(SYSCTL_HANDLER_ARGS) +{ + struct vm_pagequeue *pq; + uint64_t ret; + int dom, i; + + ret = counter_u64_fetch(vm_cnt.v_pdpages); + for (dom = 0; dom < vm_ndomains; dom++) + for (i = 0; i < PQ_COUNT; i++) { + pq = &VM_DOMAIN(dom)->vmd_pagequeues[i]; + ret += pq->pq_pdpages; + } + return (SYSCTL_OUT(req, &ret, sizeof(ret))); +} +SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdpages, + CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_RD, NULL, 0, sysctl_vm_pdpages, "QU", + "Pages analyzed by pagedaemon"); + static void vm_domain_stats_init(struct vm_domain *vmd, struct sysctl_oid *parent) { @@ -486,15 +503,31 @@ vm_domain_stats_init(struct vm_domain *vmd, struct sys SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "active", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_ACTIVE].pq_cnt, 0, "Active pages"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "actpdpgs", CTLFLAG_RD, + &vmd->vmd_pagequeues[PQ_ACTIVE].pq_pdpages, 0, + "Active pages scanned by the page daemon"); SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "inactive", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt, 0, "Inactive pages"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "inactpdpgs", CTLFLAG_RD, + &vmd->vmd_pagequeues[PQ_INACTIVE].pq_pdpages, 0, + "Inactive pages scanned by the page daemon"); SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "laundry", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt, 0, "laundry pages"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "laundpdpgs", CTLFLAG_RD, + &vmd->vmd_pagequeues[PQ_LAUNDRY].pq_pdpages, 0, + "Laundry pages scanned by the page daemon"); SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "unswappable", CTLFLAG_RD, &vmd->vmd_pagequeues[PQ_UNSWAPPABLE].pq_cnt, 0, "Unswappable pages"); + SYSCTL_ADD_U64(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "unswppdpgs", CTLFLAG_RD, + &vmd->vmd_pagequeues[PQ_UNSWAPPABLE].pq_pdpages, 0, + "Unswappable pages scanned by the page daemon"); SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "inactive_target", CTLFLAG_RD, &vmd->vmd_inactive_target, 0, "Target inactive pages"); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Aug 23 20:44:26 2018 (r338277) +++ head/sys/vm/vm_page.c Thu Aug 23 21:03:45 2018 (r338278) @@ -481,6 +481,7 @@ vm_page_domain_init(int domain) TAILQ_INIT(&pq->pq_pl); mtx_init(&pq->pq_mutex, pq->pq_name, "vm pagequeue", MTX_DEF | MTX_DUPOK); + pq->pq_pdpages = 0; vm_page_init_marker(&vmd->vmd_markers[i], i, 0); } mtx_init(&vmd->vmd_free_mtx, "vm page free queue", NULL, MTX_DEF); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Thu Aug 23 20:44:26 2018 (r338277) +++ head/sys/vm/vm_pageout.c Thu Aug 23 21:03:45 2018 (r338278) @@ -246,7 +246,7 @@ vm_pageout_end_scan(struct scan_state *ss) TAILQ_REMOVE(&pq->pq_pl, ss->marker, plinks.q); vm_page_aflag_clear(ss->marker, PGA_ENQUEUED); - VM_CNT_ADD(v_pdpages, ss->scanned); + pq->pq_pdpages += ss->scanned; } /* Modified: head/sys/vm/vm_pagequeue.h ============================================================================== --- head/sys/vm/vm_pagequeue.h Thu Aug 23 20:44:26 2018 (r338277) +++ head/sys/vm/vm_pagequeue.h Thu Aug 23 21:03:45 2018 (r338278) @@ -71,6 +71,7 @@ struct vm_pagequeue { struct pglist pq_pl; int pq_cnt; const char * const pq_name; + uint64_t pq_pdpages; } __aligned(CACHE_LINE_SIZE); #ifndef VM_BATCHQUEUE_SIZE