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.
This commit is contained in:
Brian Behlendorf
2011-03-30 17:44:35 -07:00
parent 83150861e6
commit e76f4bf11d
6 changed files with 283 additions and 1 deletions
Vendored
+164
View File
@@ -15462,6 +15462,88 @@ _ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking whether symbol shrink_dcache_memory is exported" >&5
$as_echo_n "checking whether symbol shrink_dcache_memory is exported... " >&6; }
grep -q -E '[[:space:]]shrink_dcache_memory[[:space:]]' \
$LINUX_OBJ/Module*.symvers 2>/dev/null
rc=$?
if test $rc -ne 0; then
export=0
for file in fs/dcache.c; do
grep -q -E "EXPORT_SYMBOL.*(shrink_dcache_memory)" \
"$LINUX_OBJ/$file" 2>/dev/null
rc=$?
if test $rc -eq 0; then
export=1
break;
fi
done
if test $export -eq 0; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_DCACHE_MEMORY 1
_ACEOF
fi
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_DCACHE_MEMORY 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking whether symbol shrink_icache_memory is exported" >&5
$as_echo_n "checking whether symbol shrink_icache_memory is exported... " >&6; }
grep -q -E '[[:space:]]shrink_icache_memory[[:space:]]' \
$LINUX_OBJ/Module*.symvers 2>/dev/null
rc=$?
if test $rc -ne 0; then
export=0
for file in fs/inode.c; do
grep -q -E "EXPORT_SYMBOL.*(shrink_icache_memory)" \
"$LINUX_OBJ/$file" 2>/dev/null
rc=$?
if test $rc -eq 0; then
export=1
break;
fi
done
if test $export -eq 0; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_ICACHE_MEMORY 1
_ACEOF
fi
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_ICACHE_MEMORY 1
_ACEOF
fi
;;
user)
@@ -19285,6 +19367,88 @@ _ACEOF
{ $as_echo "$as_me:$LINENO: checking whether symbol shrink_dcache_memory is exported" >&5
$as_echo_n "checking whether symbol shrink_dcache_memory is exported... " >&6; }
grep -q -E '[[:space:]]shrink_dcache_memory[[:space:]]' \
$LINUX_OBJ/Module*.symvers 2>/dev/null
rc=$?
if test $rc -ne 0; then
export=0
for file in fs/dcache.c; do
grep -q -E "EXPORT_SYMBOL.*(shrink_dcache_memory)" \
"$LINUX_OBJ/$file" 2>/dev/null
rc=$?
if test $rc -eq 0; then
export=1
break;
fi
done
if test $export -eq 0; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_DCACHE_MEMORY 1
_ACEOF
fi
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_DCACHE_MEMORY 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking whether symbol shrink_icache_memory is exported" >&5
$as_echo_n "checking whether symbol shrink_icache_memory is exported... " >&6; }
grep -q -E '[[:space:]]shrink_icache_memory[[:space:]]' \
$LINUX_OBJ/Module*.symvers 2>/dev/null
rc=$?
if test $rc -ne 0; then
export=0
for file in fs/inode.c; do
grep -q -E "EXPORT_SYMBOL.*(shrink_icache_memory)" \
"$LINUX_OBJ/$file" 2>/dev/null
rc=$?
if test $rc -eq 0; then
export=1
break;
fi
done
if test $export -eq 0; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_ICACHE_MEMORY 1
_ACEOF
fi
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_SHRINK_ICACHE_MEMORY 1
_ACEOF
fi
if test "x$AWK" != xgawk; then