projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2760bfe
)
bcachefs: Leave a buffer in the btree key cache to avoid lock thrashing
author
Kent Overstreet
<kent.overstreet@linux.dev>
Fri, 7 Jun 2024 18:25:18 +0000
(14:25 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Mon, 10 Jun 2024 17:17:16 +0000
(13:17 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_key_cache.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/btree_key_cache.c
b/fs/bcachefs/btree_key_cache.c
index
2ad3d27
..
2d3c0d4
100644
(file)
--- a/
fs/bcachefs/btree_key_cache.c
+++ b/
fs/bcachefs/btree_key_cache.c
@@
-915,6
+915,14
@@
static unsigned long bch2_btree_key_cache_count(struct shrinker *shrink,
long nr = atomic_long_read(&bc->nr_keys) -
atomic_long_read(&bc->nr_dirty);
+ /*
+ * Avoid hammering our shrinker too much if it's nearly empty - the
+ * shrinker code doesn't take into account how big our cache is, if it's
+ * mostly empty but the system is under memory pressure it causes nasty
+ * lock contention:
+ */
+ nr -= 128;
+
return max(0L, nr);
}