Skip to content

Commit 534f7ef

Browse files
adam900710kdave
authored andcommitted
btrfs: only enable extent map shrinker for DEBUG builds
Although there are several patches improving the extent map shrinker, there are still reports of too frequent shrinker behavior, taking too much CPU for the kswapd process. So let's only enable extent shrinker for now, until we got more comprehensive understanding and a better solution. Link: https://lore.kernel.org/linux-btrfs/3df4acd616a07ef4d2dc6bad668701504b412ffc.camel@intelfx.name/ Link: https://lore.kernel.org/linux-btrfs/c30fd6b3-ca7a-4759-8a53-d42878bf84f7@gmail.com/ Fixes: 956a17d ("btrfs: add a shrinker for extent maps") CC: stable@vger.kernel.org # 6.10+ Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent e30729d commit 534f7ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/btrfs/super.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,13 @@ static long btrfs_nr_cached_objects(struct super_block *sb, struct shrink_contro
24022402

24032403
trace_btrfs_extent_map_shrinker_count(fs_info, nr);
24042404

2405-
return nr;
2405+
/*
2406+
* Only report the real number for DEBUG builds, as there are reports of
2407+
* serious performance degradation caused by too frequent shrinks.
2408+
*/
2409+
if (IS_ENABLED(CONFIG_BTRFS_DEBUG))
2410+
return nr;
2411+
return 0;
24062412
}
24072413

24082414
static long btrfs_free_cached_objects(struct super_block *sb, struct shrink_control *sc)

0 commit comments

Comments
 (0)