Add a tunable to set the pgcache zone's maxcache

When it is set to 0 (the default), a heavy Netflix-style web workload
suffers from heavy lock contention on the vm page free queue called from
vm_page_zone_{import,release}() as the buckets are frequently drained.
When setting the maxcache, this contention goes away.

We should eventually try to autotune this, as well as make this
zone eligable for uma_reclaim().

Reviewed by:	alc, markj
Not Objected to by: jeff
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D22112
This commit is contained in:
Andrew Gallatin 2019-10-24 18:39:05 +00:00
parent 7d29eb9a91
commit 0dc59d7632

View File

@ -216,8 +216,10 @@ vm_page_init_cache_zones(void *dummy __unused)
{
struct vm_domain *vmd;
struct vm_pgcache *pgcache;
int domain, pool;
int domain, maxcache, pool;
maxcache = 0;
TUNABLE_INT_FETCH("vm.pgcache_zone_max", &maxcache);
for (domain = 0; domain < vm_ndomains; domain++) {
vmd = VM_DOMAIN(domain);
@ -237,7 +239,7 @@ vm_page_init_cache_zones(void *dummy __unused)
sizeof(struct vm_page), NULL, NULL, NULL, NULL,
vm_page_zone_import, vm_page_zone_release, pgcache,
UMA_ZONE_MAXBUCKET | UMA_ZONE_VM);
(void)uma_zone_set_maxcache(pgcache->zone, 0);
(void)uma_zone_set_maxcache(pgcache->zone, maxcache);
}
}
}