summaryrefslogtreecommitdiffstats
path: root/include/sys/kmem.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-05-16 09:29:21 -0700
committerBrian Behlendorf <[email protected]>2014-05-22 10:30:12 -0700
commit376dc35e228498da7703e7ca4c2b75d16763c23b (patch)
tree76f8b0faab10f9a77d8df49d56819771ea4e9816 /include/sys/kmem.h
parenta073aeb0604b7d410be58135fb9d5c43671af263 (diff)
Add spl_kmem_cache_reclaim module option
The correct behavior for all registered shrinkers is to return the number of objects in their cache. In theory this allows the Linux VM to balance memory reclaim across all registered caches. In commit b9b3715 this behavior was disabled in favor of returning -1 which notifies the VM that no additional objects are available for reclaim. This was done as a workaround to resolve thrashing in shrink_slabs() which could occur when memory was low and numerous core where in reclaim. Unfortunately, this has been observed to increase the likelihood of OOM events when SPL slab consumers are responsible for consuming the majority of memory. Therefore, this patch makes this behavior tunable. Setting the spl_kmem_cache_reclaim module option to 0x1 will result in the shrinker only being called once. This is the default behavior. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Prakash Surya <[email protected]> Closes #358
Diffstat (limited to 'include/sys/kmem.h')
-rw-r--r--include/sys/kmem.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sys/kmem.h b/include/sys/kmem.h
index 18533fe39..3418d3dd4 100644
--- a/include/sys/kmem.h
+++ b/include/sys/kmem.h
@@ -385,6 +385,8 @@ typedef enum kmem_cbrc {
#define KMC_EXPIRE_AGE 0x1 /* Due to age */
#define KMC_EXPIRE_MEM 0x2 /* Due to low memory */
+#define KMC_RECLAIM_ONCE 0x1 /* Force a single shrinker pass */
+
extern unsigned int spl_kmem_cache_expire;
extern struct list_head spl_kmem_cache_list;
extern struct rw_semaphore spl_kmem_cache_sem;