diff options
author | Brian Behlendorf <[email protected]> | 2011-03-30 17:44:35 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-04-06 20:06:03 -0700 |
commit | e76f4bf11d54479fe767d9647a10e8b98d7ffc4f (patch) | |
tree | 213970e408e6c9b808184abd7fb7e3920cee0c52 /module | |
parent | 83150861e610701d44510816e2062bcf407f51ab (diff) |
Add dnlc_reduce_cache() support
Provide the dnlc_reduce_cache() function which attempts to prune
cached entries from the dcache and icache. After the entries are
pruned any slabs which they may have been using are reaped.
Note the API takes a reclaim percentage but we don't have easy
access to the total number of cache entries to calculate the
reclaim count. However, in practice this doesn't need to be
exactly correct. We simply need to reclaim some useful fraction
(but not all) of the cache. The caller can determine if more
needs to be done.
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-kmem.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 87594bde9..d96456cbc 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -185,6 +185,16 @@ invalidate_inodes_t invalidate_inodes_fn = SYMBOL_POISON; EXPORT_SYMBOL(invalidate_inodes_fn); #endif /* HAVE_INVALIDATE_INODES */ +#ifndef HAVE_SHRINK_DCACHE_MEMORY +shrink_dcache_memory_t shrink_dcache_memory_fn = SYMBOL_POISON; +EXPORT_SYMBOL(shrink_dcache_memory_fn); +#endif /* HAVE_SHRINK_DCACHE_MEMORY */ + +#ifndef HAVE_SHRINK_ICACHE_MEMORY +shrink_icache_memory_t shrink_icache_memory_fn = SYMBOL_POISON; +EXPORT_SYMBOL(shrink_icache_memory_fn); +#endif /* HAVE_SHRINK_ICACHE_MEMORY */ + pgcnt_t spl_kmem_availrmem(void) { @@ -2102,6 +2112,24 @@ spl_kmem_init_kallsyms_lookup(void) } #endif /* HAVE_INVALIDATE_INODES */ +#ifndef HAVE_SHRINK_DCACHE_MEMORY + shrink_dcache_memory_fn = (shrink_dcache_memory_t) + spl_kallsyms_lookup_name("shrink_dcache_memory"); + if (!shrink_dcache_memory_fn) { + printk(KERN_ERR "Error: Unknown symbol shrink_dcache_memory\n"); + return -EFAULT; + } +#endif /* HAVE_SHRINK_DCACHE_MEMORY */ + +#ifndef HAVE_SHRINK_ICACHE_MEMORY + shrink_icache_memory_fn = (shrink_icache_memory_t) + spl_kallsyms_lookup_name("shrink_icache_memory"); + if (!shrink_icache_memory_fn) { + printk(KERN_ERR "Error: Unknown symbol shrink_icache_memory\n"); + return -EFAULT; + } +#endif /* HAVE_SHRINK_ICACHE_MEMORY */ + return 0; } |