diff options
author | Kent Overstreet <koverstreet@google.com> | 2013-06-03 13:04:56 -0700 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-07-01 14:42:48 -0700 |
commit | 36c9ea9837c1cb21c778781495101eaff7e5eb56 (patch) | |
tree | fca141a1e72ac261bee9b58049524ab2849018bf /drivers/md | |
parent | e49c7c374e7aacd1f04ecbc21d9dbbeeea4a77d6 (diff) | |
download | kernel-common-36c9ea9837c1cb21c778781495101eaff7e5eb56.tar.gz kernel-common-36c9ea9837c1cb21c778781495101eaff7e5eb56.tar.bz2 kernel-common-36c9ea9837c1cb21c778781495101eaff7e5eb56.zip |
bcache: Document shrinker reserve better
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/btree.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index a6ad49ac5f2b..04636a70ffaa 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -622,6 +622,13 @@ static int bch_mca_shrink(struct shrinker *shrink, struct shrink_control *sc) else if (!mutex_trylock(&c->bucket_lock)) return -1; + /* + * It's _really_ critical that we don't free too many btree nodes - we + * have to always leave ourselves a reserve. The reserve is how we + * guarantee that allocating memory for a new btree node can always + * succeed, so that inserting keys into the btree can always succeed and + * IO can always make forward progress: + */ nr /= c->btree_pages; nr = min_t(unsigned long, nr, mca_can_free(c)); |