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
This commit is contained in:
Mark Johnston 2019-10-18 17:36:42 +00:00
parent c456a0a1a6
commit d307bdcc2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353734

View File

@ -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];