From owner-svn-src-all@freebsd.org Thu Aug 6 21:27:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18DAF9B58CC; Thu, 6 Aug 2015 21:27:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5B6879F; Thu, 6 Aug 2015 21:27:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t76LRpxa039328; Thu, 6 Aug 2015 21:27:51 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t76LRpOi039327; Thu, 6 Aug 2015 21:27:51 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201508062127.t76LRpOi039327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 6 Aug 2015 21:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286390 - head/sys/vm X-SVN-Group: head 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.20 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: Thu, 06 Aug 2015 21:27:52 -0000 Author: alc Date: Thu Aug 6 21:27:50 2015 New Revision: 286390 URL: https://svnweb.freebsd.org/changeset/base/286390 Log: Introduce a sysctl for reporting the number of fully populated reservations. Modified: head/sys/vm/vm_reserv.c Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Thu Aug 6 20:59:03 2015 (r286389) +++ head/sys/vm/vm_reserv.c Thu Aug 6 21:27:50 2015 (r286390) @@ -217,6 +217,11 @@ static long vm_reserv_freed; SYSCTL_LONG(_vm_reserv, OID_AUTO, freed, CTLFLAG_RD, &vm_reserv_freed, 0, "Cumulative number of freed reservations"); +static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS); + +SYSCTL_PROC(_vm_reserv, OID_AUTO, fullpop, CTLTYPE_INT | CTLFLAG_RD, NULL, 0, + sysctl_vm_reserv_fullpop, "I", "Current number of full reservations"); + static int sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS); SYSCTL_OID(_vm_reserv, OID_AUTO, partpopq, CTLTYPE_STRING | CTLFLAG_RD, NULL, 0, @@ -235,6 +240,33 @@ static void vm_reserv_populate(vm_reser static void vm_reserv_reclaim(vm_reserv_t rv); /* + * Returns the current number of full reservations. + * + * Since the number of full reservations is computed without acquiring the + * free page queue lock, the returned value may be inexact. + */ +static int +sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS) +{ + vm_paddr_t paddr; + struct vm_phys_seg *seg; + vm_reserv_t rv; + int fullpop, segind; + + fullpop = 0; + for (segind = 0; segind < vm_phys_nsegs; segind++) { + seg = &vm_phys_segs[segind]; + paddr = roundup2(seg->start, VM_LEVEL_0_SIZE); + while (paddr + VM_LEVEL_0_SIZE <= seg->end) { + rv = &vm_reserv_array[paddr >> VM_LEVEL_0_SHIFT]; + fullpop += rv->popcnt == VM_LEVEL_0_NPAGES; + paddr += VM_LEVEL_0_SIZE; + } + } + return (sysctl_handle_int(oidp, &fullpop, 0, req)); +} + +/* * Describes the current state of the partially-populated reservation queue. */ static int