aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys/kmem.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-01-18 15:44:27 -0800
committerBrian Behlendorf <[email protected]>2013-01-28 09:34:12 -0800
commit0936c3449fc81caeed49d23e1705a9decd964700 (patch)
tree633fa1c3409297ab093fc72485b6d9ce70381dd3 /include/sys/kmem.h
parent84dd1f4f158c2da72f50d5ee5cd798197303ab23 (diff)
Add spl_kmem_cache_expire module option
Cache aging was implemented because it was part of the default Solaris kmem_cache behavior. The idea is that per-cpu objects which haven't been accessed in several seconds should be returned to the cache. On the other hand Linux slabs never move objects back to the slabs unless there is memory pressure on the system. This behavior is now configurable through the 'spl_kmem_cache_expire' module option. The value is a bit mask with the following meaning. 0x1 - Solaris style cache aging eviction is enabled. 0x2 - Linux style low memory eviction is enabled. Both methods may be safely enabled simultaneously, but by default both are disabled. It has never been clear if the kmem cache aging (which has been around from day one) actually does any good. It has however been the source of numerous bugs so I wouldn't mind retiring it entirely. Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/zfs#1227 Closes #210
Diffstat (limited to 'include/sys/kmem.h')
-rw-r--r--include/sys/kmem.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/sys/kmem.h b/include/sys/kmem.h
index 6904bec3f..d5d3061a5 100644
--- a/include/sys/kmem.h
+++ b/include/sys/kmem.h
@@ -377,9 +377,13 @@ typedef enum kmem_cbrc {
#define KMC_ALLOC (1 << KMC_BIT_ALLOC)
#define KMC_MAX (1 << KMC_BIT_MAX)
-#define KMC_REAP_CHUNK INT_MAX
-#define KMC_DEFAULT_SEEKS 1
+#define KMC_REAP_CHUNK INT_MAX
+#define KMC_DEFAULT_SEEKS 1
+#define KMC_EXPIRE_AGE 0x1 /* Due to age */
+#define KMC_EXPIRE_MEM 0x2 /* Due to low memory */
+
+extern unsigned int spl_kmem_cache_expire;
extern struct list_head spl_kmem_cache_list;
extern struct rw_semaphore spl_kmem_cache_sem;