Skip to content

Commit 41fb0fa

Browse files
black-deskhsiangkao
authored andcommitted
erofs: return SHRINK_EMPTY if no objects to free
Comments in file include/linux/shrinker.h says that `count_objects` of `struct shrinker` should return SHRINK_EMPTY when there are no objects to free. > If there are no objects to free, it should return SHRINK_EMPTY, > while 0 is returned in cases of the number of freeable items cannot > be determined or shrinker should skip this cache for this time > (e.g., their number is below shrinkable limit). Signed-off-by: Chen Linxuan <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/149E6E64B5B6B5E8+20250116083303.199817-1-chenlinxuan@uniontech.com [ Gao Xiang: should have no impact since it's not memcg-aware. ] Signed-off-by: Gao Xiang <[email protected]>
1 parent e180b8c commit 41fb0fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/erofs/zutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void erofs_shrinker_unregister(struct super_block *sb)
243243
static unsigned long erofs_shrink_count(struct shrinker *shrink,
244244
struct shrink_control *sc)
245245
{
246-
return atomic_long_read(&erofs_global_shrink_cnt);
246+
return atomic_long_read(&erofs_global_shrink_cnt) ?: SHRINK_EMPTY;
247247
}
248248

249249
static unsigned long erofs_shrink_scan(struct shrinker *shrink,

0 commit comments

Comments
 (0)