Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Apr 2012 14:52:28 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r233780 - in stable/7/sys: amd64/amd64 amd64/conf conf
Message-ID:  <201204021452.q32EqSoe002585@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Apr  2 14:52:28 2012
New Revision: 233780
URL: http://svn.freebsd.org/changeset/base/233780

Log:
  MFC 233256:
  Eliminate vm.pmap.shpgperproc and vm.pmap.pv_entry_max because they no
  longer serve any purpose.

Modified:
  stable/7/sys/amd64/amd64/pmap.c
  stable/7/sys/amd64/conf/NOTES
  stable/7/sys/conf/options.amd64
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/7/sys/amd64/amd64/pmap.c	Mon Apr  2 12:00:35 2012	(r233779)
+++ stable/7/sys/amd64/amd64/pmap.c	Mon Apr  2 14:52:28 2012	(r233780)
@@ -106,7 +106,6 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_msgbuf.h"
-#include "opt_pmap.h"
 #include "opt_vm.h"
 
 #include <sys/param.h>
@@ -148,10 +147,6 @@ __FBSDID("$FreeBSD$");
 #include <machine/smp.h>
 #endif
 
-#ifndef PMAP_SHPGPERPROC
-#define PMAP_SHPGPERPROC 200
-#endif
-
 #if !defined(DIAGNOSTIC)
 #define PMAP_INLINE	__gnu89_inline
 #else
@@ -195,9 +190,8 @@ static u_int64_t	DMPDPphys;	/* phys addr
 /*
  * Data for the pv entry allocation mechanism
  */
-static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
+static int pv_entry_count;
 static struct md_page *pv_table;
-static int shpgperproc = PMAP_SHPGPERPROC;
 
 /*
  * All those kernel PT submaps that BSD is so fond of
@@ -212,7 +206,7 @@ struct msgbuf *msgbufp = 0;
 static caddr_t crashdumpmap;
 
 static void	free_pv_entry(pmap_t pmap, pv_entry_t pv);
-static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
+static pv_entry_t get_pv_entry(pmap_t locked_pmap, boolean_t try);
 static void	pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static void	pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
@@ -651,16 +645,6 @@ pmap_init(void)
 	}
 
 	/*
-	 * Initialize the address space (zone) for the pv entries.  Set a
-	 * high water mark so that the system can recover from excessive
-	 * numbers of pv entries.
-	 */
-	TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc);
-	pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
-	TUNABLE_INT_FETCH("vm.pmap.pv_entries", &pv_entry_max);
-	pv_entry_high_water = 9 * (pv_entry_max / 10);
-
-	/*
 	 * If the kernel is running in a virtual machine on an AMD Family 10h
 	 * processor, then it must assume that MCA is enabled by the virtual
 	 * machine monitor.
@@ -695,36 +679,6 @@ pmap_init(void)
 		TAILQ_INIT(&pv_table[i].pv_list);
 }
 
-static int
-pmap_pventry_proc(SYSCTL_HANDLER_ARGS)
-{
-	int error;
-
-	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
-	if (error == 0 && req->newptr) {
-		shpgperproc = (pv_entry_max - cnt.v_page_count) / maxproc;
-		pv_entry_high_water = 9 * (pv_entry_max / 10);
-	}
-	return (error);
-}
-SYSCTL_PROC(_vm_pmap, OID_AUTO, pv_entry_max, CTLTYPE_INT|CTLFLAG_RW, 
-    &pv_entry_max, 0, pmap_pventry_proc, "IU", "Max number of PV entries");
-
-static int
-pmap_shpgperproc_proc(SYSCTL_HANDLER_ARGS)
-{
-	int error;
-
-	error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req);
-	if (error == 0 && req->newptr) {
-		pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
-		pv_entry_high_water = 9 * (pv_entry_max / 10);
-	}
-	return (error);
-}
-SYSCTL_PROC(_vm_pmap, OID_AUTO, shpgperproc, CTLTYPE_INT|CTLFLAG_RW, 
-    &shpgperproc, 0, pmap_shpgperproc_proc, "IU", "Page share factor per proc");
-
 SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0,
     "2MB page mapping counters");
 
@@ -2071,10 +2025,8 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
  * when needed.
  */
 static pv_entry_t
-get_pv_entry(pmap_t pmap, int try)
+get_pv_entry(pmap_t pmap, boolean_t try)
 {
-	static const struct timeval printinterval = { 60, 0 };
-	static struct timeval lastprint;
 	static vm_pindex_t colour;
 	struct vpgqueues *pq;
 	int bit, field;
@@ -2085,12 +2037,6 @@ get_pv_entry(pmap_t pmap, int try)
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	PV_STAT(pv_entry_allocs++);
-	pv_entry_count++;
-	if (pv_entry_count > pv_entry_high_water)
-		if (ratecheck(&lastprint, &printinterval))
-			printf("Approaching the limit on PV entries, consider "
-			    "increasing either the vm.pmap.shpgperproc or the "
-			    "vm.pmap.pv_entry_max sysctl.\n");
 	pq = NULL;
 retry:
 	pc = TAILQ_FIRST(&pmap->pm_pvchunk);
@@ -2108,8 +2054,10 @@ retry:
 			if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 &&
 			    pc->pc_map[2] == 0) {
 				TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
-				TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list);
+				TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc,
+				    pc_list);
 			}
+			pv_entry_count++;
 			PV_STAT(pv_entry_spare--);
 			return (pv);
 		}
@@ -2120,7 +2068,6 @@ retry:
 	    VM_ALLOC_WIRED);
 	if (m == NULL) {
 		if (try) {
-			pv_entry_count--;
 			PV_STAT(pc_chunk_tryfail++);
 			return (NULL);
 		}
@@ -2136,7 +2083,7 @@ retry:
 			PV_STAT(pmap_collect_active++);
 			pq = &vm_page_queues[PQ_ACTIVE];
 		} else
-			panic("get_pv_entry: increase vm.pmap.shpgperproc");
+			panic("get_pv_entry: allocation failed");
 		pmap_collect(pmap, pq);
 		goto retry;
 	}
@@ -2151,6 +2098,7 @@ retry:
 	pc->pc_map[2] = PC_FREE2;
 	pv = &pc->pc_pventry[0];
 	TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
+	pv_entry_count++;
 	PV_STAT(pv_entry_spare += _NPCPV - 1);
 	return (pv);
 }
@@ -2308,8 +2256,7 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	if (pv_entry_count < pv_entry_high_water && 
-	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
+	if ((pv = get_pv_entry(pmap, TRUE)) != NULL) {
 		pv->pv_va = va;
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 		return (TRUE);
@@ -2327,8 +2274,7 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
 	pv_entry_t pv;
 
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	if (pv_entry_count < pv_entry_high_water && 
-	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
+	if ((pv = get_pv_entry(pmap, TRUE)) != NULL) {
 		pv->pv_va = va;
 		pvh = pa_to_pvh(pa);
 		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);

Modified: stable/7/sys/amd64/conf/NOTES
==============================================================================
--- stable/7/sys/amd64/conf/NOTES	Mon Apr  2 12:00:35 2012	(r233779)
+++ stable/7/sys/amd64/conf/NOTES	Mon Apr  2 14:52:28 2012	(r233780)
@@ -593,19 +593,6 @@ device		cpuctl
 #
 options 	ENABLE_ALART		# Control alarm on Intel intpm driver
 
-#
-# Set the number of PV entries per process.  Increasing this can
-# stop panics related to heavy use of shared memory.  However, that can
-# (combined with large amounts of physical memory) cause panics at
-# boot time due the kernel running out of VM space.
-#
-# If you're tweaking this, you might also want to increase the sysctls
-# "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target".
-#
-# The value below is the one more than the default.
-#
-options 	PMAP_SHPGPERPROC=201
-
 
 #####################################################################
 # ABI Emulation

Modified: stable/7/sys/conf/options.amd64
==============================================================================
--- stable/7/sys/conf/options.amd64	Mon Apr  2 12:00:35 2012	(r233779)
+++ stable/7/sys/conf/options.amd64	Mon Apr  2 14:52:28 2012	(r233780)
@@ -5,7 +5,6 @@ AUTO_EOI_1		opt_auto_eoi.h
 AUTO_EOI_2		opt_auto_eoi.h
 MAXMEM
 PERFMON
-PMAP_SHPGPERPROC	opt_pmap.h
 MP_WATCHDOG
 
 # Options for emulators.  These should only be used at config time, so



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204021452.q32EqSoe002585>