From owner-svn-src-all@freebsd.org Wed Sep 25 17:08:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EFF012D499; Wed, 25 Sep 2019 17:08:36 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dkzS2Gkqz4B3x; Wed, 25 Sep 2019 17:08:36 +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 2C7021AD02; Wed, 25 Sep 2019 17:08:36 +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 x8PH8aNu046764; Wed, 25 Sep 2019 17:08:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PH8a3s046763; Wed, 25 Sep 2019 17:08:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909251708.x8PH8a3s046763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 25 Sep 2019 17:08:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352690 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 352690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 17:08:36 -0000 Author: markj Date: Wed Sep 25 17:08:35 2019 New Revision: 352690 URL: https://svnweb.freebsd.org/changeset/base/352690 Log: Add some counters for per-VM page events. For now, just count batched page queue state operations. vm.stats.page.queue_ops counts the number of batch entries that successfully completed, while queue_nops counts entries that had no effect, which occurs when the queue operation had been completed before the batch entry was processed. Reviewed by: alc, kib MFC after: 1 week Sponsored by: Intel, Netflix Differential Revision: https://reviews.freebsd.org/D21782 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Sep 25 16:49:22 2019 (r352689) +++ head/sys/vm/vm_page.c Wed Sep 25 17:08:35 2019 (r352690) @@ -73,11 +73,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include #include +#include #include #include #include @@ -130,6 +131,28 @@ static int vm_min_waiters; static int vm_severe_waiters; static int vm_pageproc_waiters; +static SYSCTL_NODE(_vm_stats, OID_AUTO, page, CTLFLAG_RD, 0, + "VM page statistics"); + +static counter_u64_t queue_ops = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_ops, + CTLFLAG_RD, &queue_ops, + "Number of batched queue operations"); + +static counter_u64_t queue_nops = EARLY_COUNTER; +SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_nops, + CTLFLAG_RD, &queue_nops, + "Number of batched queue operations with no effects"); + +static void +counter_startup(void) +{ + + queue_ops = counter_u64_alloc(M_WAITOK); + queue_nops = counter_u64_alloc(M_WAITOK); +} +SYSINIT(page_counters, SI_SUB_CPU, SI_ORDER_ANY, counter_startup, NULL); + /* * bogus page -- for I/O to/from partially complete buffers, * or for paging into sparsely invalid regions. @@ -3117,6 +3140,7 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa if (__predict_true((qflags & PGA_ENQUEUED) != 0)) vm_pagequeue_remove(pq, m); vm_page_dequeue_complete(m); + counter_u64_add(queue_ops, 1); } else if ((qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) { if ((qflags & PGA_ENQUEUED) != 0) TAILQ_REMOVE(&pq->pq_pl, m, plinks.q); @@ -3141,6 +3165,9 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa vm_page_aflag_clear(m, qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)); + counter_u64_add(queue_ops, 1); + } else { + counter_u64_add(queue_nops, 1); } }