From owner-p4-projects@FreeBSD.ORG Tue Mar 14 23:48:53 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F238816A423; Tue, 14 Mar 2006 23:48:52 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B7DE316A400 for ; Tue, 14 Mar 2006 23:48:52 +0000 (UTC) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A5C243D72 for ; Tue, 14 Mar 2006 23:48:48 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2ENmmbu095532 for ; Tue, 14 Mar 2006 23:48:48 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2ENmlWF095529 for perforce@freebsd.org; Tue, 14 Mar 2006 23:48:47 GMT (envelope-from peter@freebsd.org) Date: Tue, 14 Mar 2006 23:48:47 GMT Message-Id: <200603142348.k2ENmlWF095529@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 93322 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2006 23:48:53 -0000 http://perforce.freebsd.org/chv.cgi?CH=93322 Change 93322 by peter@peter_melody on 2006/03/14 23:48:30 add some stats Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/pmap.c#138 edit Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#138 (text+ko) ==== @@ -1451,6 +1451,32 @@ #define PC_FREE1 0xfffffffffffffffful #define PC_FREE2 0x000000fffffffffful +static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees; + +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_count, CTLFLAG_RD, &pc_chunk_count, 0, + "Current number of pv entry chunks"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_allocs, CTLFLAG_RD, &pc_chunk_allocs, 0, + "Current number of pv entry chunks allocated"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_frees, CTLFLAG_RD, &pc_chunk_frees, 0, + "Current number of pv entry chunks frees"); + +static int pv_entry_frees, pv_entry_allocs, pv_entry_spare; + +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, + "Current number of pv entries"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0, + "Current number of pv entry frees"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 0, + "Current number of pv entry allocs"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, + "Current number of spare pv entries"); + +static int pmap_collect_inactive, pmap_collect_active; + +SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_collect_inactive, CTLFLAG_RD, &pmap_collect_inactive, 0, + "Current number times pmap_collect called on inactive queue"); +SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_collect_active, CTLFLAG_RD, &pmap_collect_active, 0, + "Current number times pmap_collect called on active queue"); /* * We are in a serious low memory condition. Resort to * drastic measures to free some pages so we can allocate @@ -1516,6 +1542,8 @@ struct pv_chunk *pc; int idx, field, bit; + pv_entry_frees++; + pv_entry_spare++; pv_entry_count--; pc = pv_to_chunk(pv); idx = pv - &pc->pc_pventry[0]; @@ -1528,6 +1556,9 @@ if (pc->pc_map[0] != PC_FREE0 || pc->pc_map[1] != PC_FREE1 || pc->pc_map[2] != PC_FREE2) return; + pv_entry_spare -= _NPCPV; + pc_chunk_count--; + pc_chunk_frees++; /* entire chunk is free, return it */ TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); @@ -1553,6 +1584,7 @@ PMAP_LOCK_ASSERT(pmap, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); + pv_entry_allocs++; pv_entry_count++; if (pv_entry_count > pv_entry_high_water) pagedaemon_wakeup(); @@ -1575,6 +1607,7 @@ TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } + pv_entry_spare--; return (pv); } alloc: @@ -1590,15 +1623,19 @@ printf("Approaching the limit on PV entries, consider " "increasing sysctl vm.pmap.shpgperproc or " "vm.pmap.pv_entry_max\n"); + pmap_collect_inactive++; pmap_collect(pmap, &vm_page_queues[PQ_INACTIVE]); m = vm_page_alloc(NULL, colour, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ); if (m == NULL) { + pmap_collect_active++; pmap_collect(pmap, &vm_page_queues[PQ_ACTIVE]); m = vm_page_alloc(NULL, colour, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ); if (m == NULL) panic("get_pv_entry: increase vm.pmap.shpgperproc"); } } + pc_chunk_count++; + pc_chunk_allocs++; colour++; pc = (void *)PHYS_TO_DMAP(m->phys_addr); pc->pc_pmap = pmap; @@ -1607,6 +1644,7 @@ pc->pc_map[2] = PC_FREE2; pv = &pc->pc_pventry[0]; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); + pv_entry_spare += _NPCPV - 1; return (pv); }