public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to return SHRINK_EMPTY if no objects to free
@ 2025-02-10  1:24 Zhiguo Niu
  2025-02-10 10:05 ` Chao Yu
  2025-02-10 17:30 ` [f2fs-dev] " patchwork-bot+f2fs
  0 siblings, 2 replies; 3+ messages in thread
From: Zhiguo Niu @ 2025-02-10  1:24 UTC (permalink / raw)
  To: jaegeuk, chao
  Cc: linux-f2fs-devel, linux-kernel, niuzhiguo84, zhiguo.niu, ke.wang,
	Hao_hao.Wang

Quoted from include/linux/shrinker.h
"count_objects should return the number of freeable items in the cache. 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: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/shrinker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
index 45efff6..9c8d3ae 100644
--- a/fs/f2fs/shrinker.c
+++ b/fs/f2fs/shrinker.c
@@ -73,7 +73,7 @@ unsigned long f2fs_shrink_count(struct shrinker *shrink,
 		mutex_unlock(&sbi->umount_mutex);
 	}
 	spin_unlock(&f2fs_list_lock);
-	return count;
+	return count ?: SHRINK_EMPTY;
 }
 
 unsigned long f2fs_shrink_scan(struct shrinker *shrink,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: fix to return SHRINK_EMPTY if no objects to free
  2025-02-10  1:24 [PATCH] f2fs: fix to return SHRINK_EMPTY if no objects to free Zhiguo Niu
@ 2025-02-10 10:05 ` Chao Yu
  2025-02-10 17:30 ` [f2fs-dev] " patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2025-02-10 10:05 UTC (permalink / raw)
  To: Zhiguo Niu, jaegeuk
  Cc: chao, linux-f2fs-devel, linux-kernel, niuzhiguo84, ke.wang,
	Hao_hao.Wang

On 2/10/25 09:24, Zhiguo Niu wrote:
> Quoted from include/linux/shrinker.h
> "count_objects should return the number of freeable items in the cache. 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)."

Seems in 9b996468cfdb ("mm: add SHRINK_EMPTY shrinker methods return
value"), it didn't convert most of filesystems, left most filesystems
to return 0 which indicate there may have objects to free. :(

> 
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix to return SHRINK_EMPTY if no objects to free
  2025-02-10  1:24 [PATCH] f2fs: fix to return SHRINK_EMPTY if no objects to free Zhiguo Niu
  2025-02-10 10:05 ` Chao Yu
@ 2025-02-10 17:30 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2025-02-10 17:30 UTC (permalink / raw)
  To: Zhiguo Niu
  Cc: jaegeuk, chao, ke.wang, linux-kernel, linux-f2fs-devel,
	Hao_hao.Wang

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Mon, 10 Feb 2025 09:24:09 +0800 you wrote:
> Quoted from include/linux/shrinker.h
> "count_objects should return the number of freeable items in the cache. 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)."
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: fix to return SHRINK_EMPTY if no objects to free
    https://git.kernel.org/jaegeuk/f2fs/c/bd409934c061

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-10 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10  1:24 [PATCH] f2fs: fix to return SHRINK_EMPTY if no objects to free Zhiguo Niu
2025-02-10 10:05 ` Chao Yu
2025-02-10 17:30 ` [f2fs-dev] " patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox