aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/uma.h
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-09-01 22:22:43 +0000
committerMark Johnston <markj@FreeBSD.org>2019-09-01 22:22:43 +0000
commit08cfa56ea35b32be96f439c74fe6677653401e6e (patch)
tree75f59db43c15eed1be07f25f47e4f12b86a8d507 /sys/vm/uma.h
parent63cdd18e406a630d44f084697581f658a17163e0 (diff)
downloadsrc-08cfa56ea35b32be96f439c74fe6677653401e6e.tar.gz
src-08cfa56ea35b32be96f439c74fe6677653401e6e.zip
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
Notes
Notes: svn path=/head/; revision=351673
Diffstat (limited to 'sys/vm/uma.h')
-rw-r--r--sys/vm/uma.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
index 91317144461e..e61d6b093de8 100644
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -50,8 +50,6 @@ struct uma_zone;
/* Opaque type used as a handle to the zone */
typedef struct uma_zone * uma_zone_t;
-void zone_drain(uma_zone_t);
-
/*
* Item constructor
*
@@ -438,17 +436,18 @@ typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t size, int domain,
typedef void (*uma_free)(void *item, vm_size_t size, uint8_t pflag);
/*
- * Reclaims unused memory for all zones
+ * Reclaims unused memory
*
* Arguments:
- * None
+ * req Reclamation request type.
* Returns:
* None
- *
- * This should only be called by the page out daemon.
*/
-
-void uma_reclaim(void);
+#define UMA_RECLAIM_DRAIN 1 /* release bucket cache */
+#define UMA_RECLAIM_DRAIN_CPU 2 /* release bucket and per-CPU caches */
+#define UMA_RECLAIM_TRIM 3 /* trim bucket cache to WSS */
+void uma_reclaim(int req);
+void uma_zone_reclaim(uma_zone_t, int req);
/*
* Sets the alignment mask to be used for all zones requesting cache