[PATCH] erofs(shrinker): return SHRINK_EMPTY if no objects to free
Gao Xiang
hsiangkao at linux.alibaba.com
Thu Jan 16 19:45:25 AEDT 2025
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
More information about the Linux-erofs
mailing list