Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Oct 2019 17:36:42 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353734 - head/sys/vm
Message-ID:  <201910181736.x9IHagIm076595@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Oct 18 17:36:42 2019
New Revision: 353734
URL: https://svnweb.freebsd.org/changeset/base/353734

Log:
  Further constrain the use of per-CPU caches for free pages.
  
  In low memory conditions a significant number of pages may end up stuck
  in the caches, and currently these caches cannot be reaped, leading to
  spurious memory allocation failures and OOM kills.  So:
  
  - Take into account the fact that we may cache up to two full buckets
    of pages per CPU, not just one.
  - Increase the amount of RAM required per CPU to enable the caches.
  
  This is a temporary measure until the page cache management policy is
  improved.
  
  PR:		241048
  Reported and tested by:	Kevin Oberman <rkoberman@gmail.com>
  Reviewed by:	alc, kib
  Discussed with:	jeff
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D22040

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Fri Oct 18 17:01:27 2019	(r353733)
+++ head/sys/vm/vm_page.c	Fri Oct 18 17:36:42 2019	(r353734)
@@ -222,10 +222,12 @@ vm_page_init_cache_zones(void *dummy __unused)
 		vmd = VM_DOMAIN(domain);
 
 		/*
-		 * Don't allow the page caches to take up more than .25% of
-		 * memory.
+		 * Don't allow the page caches to take up more than .1875% of
+		 * memory.  A UMA bucket contains at most 256 free pages, and we
+		 * have two buckets per CPU per free pool.
 		 */
-		if (vmd->vmd_page_count / 400 < 256 * mp_ncpus * VM_NFREEPOOL)
+		if (vmd->vmd_page_count / 600 < 2 * 256 * mp_ncpus *
+		    VM_NFREEPOOL)
 			continue;
 		for (pool = 0; pool < VM_NFREEPOOL; pool++) {
 			pgcache = &vmd->vmd_pgcache[pool];



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