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 <[email protected]>
  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];
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to