freebsd-dev/lib/libmemstat
Mark Johnston 08cfa56ea3 Extend uma_reclaim() to permit different reclamation targets.
The page daemon periodically invokes uma_reclaim() to reclaim cached
items from each zone when the system is under memory pressure.  This
is important since the size of these caches is unbounded by default.
However it also results in bursts of high latency when allocating from
heavily used zones as threads miss in the per-CPU caches and must
access the keg in order to allocate new items.

With r340405 we maintain an estimate of each zone's usage of its
(per-NUMA domain) cache of full buckets.  Start making use of this
estimate to avoid reclaiming the entire cache when under memory
pressure.  In particular, introduce TRIM, DRAIN and DRAIN_CPU
verbs for uma_reclaim() and uma_zone_reclaim().  When trimming, only
items in excess of the estimate are reclaimed.  Draining a zone
reclaims all of the cached full buckets (the previous behaviour of
uma_reclaim()), and may further drain the per-CPU caches in extreme
cases.

Now, when under memory pressure, the page daemon will trim zones
rather than draining them.  As a result, heavily used zones do not incur
bursts of bucket cache misses following reclamation, but large, unused
caches will be reclaimed as before.

Reviewed by:	jeff
Tested by:	pho (an earlier version)
MFC after:	2 months
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D16667
2019-09-01 22:22:43 +00:00
..
libmemstat.3
Makefile
Makefile.depend
memstat_all.c
memstat_internal.h Add two new kernel options to control memory locality on NUMA hardware. 2019-08-06 21:50:34 +00:00
memstat_malloc.c
memstat_uma.c Extend uma_reclaim() to permit different reclamation targets. 2019-09-01 22:22:43 +00:00
memstat.c Add two new kernel options to control memory locality on NUMA hardware. 2019-08-06 21:50:34 +00:00
memstat.h Add two new kernel options to control memory locality on NUMA hardware. 2019-08-06 21:50:34 +00:00