Re: [PATCH] erofs(shrinker): return SHRINK_EMPTY if no objects to free

From: Gao Xiang
Date: Thu Jan 16 2025 - 03:45:38 EST




On 2025/1/16 16:24, Chen Linxuan wrote:
On Thu, 2025-01-16 at 15:51 +0800, Gao Xiang wrote:
Hi Linxuan,

On 2025/1/16 15:20, Chen Linxuan wrote:
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).

Thanks for the patch!

Yeah, it seems that is the case. Yet it'd better to document
what the impact if 0 is returned here if you know more..

Sorry, I have no idea about that.

I guess it has no difference if the shrinker is not memcg-aware,
see:
https://lore.kernel.org/r/153063070859.1818.11870882950920963480.stgit@localhost.localdomain

But I'm fine to use SHRINK_EMPTY since it's clearly documented.

So could you resend a patch to address my suggestion?

Thanks,
Gao Xiang