linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/zsmalloc: fix class per-fullness zspage counts
@ 2024-06-27  7:59 Chengming Zhou
  2024-06-27  7:59 ` [PATCH 2/2] mm/zsmalloc: move record_obj() into obj_malloc() Chengming Zhou
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Chengming Zhou @ 2024-06-27  7:59 UTC (permalink / raw)
  To: minchan, senozhatsky, akpm; +Cc: linux-mm, linux-kernel, chengming.zhou

We always use insert_zspage() and remove_zspage() to update zspage's
fullness location, which will account correctly.

But this special async free path use "splice" instead of remove_zspage(),
so the per-fullness zspage count for ZS_INUSE_RATIO_0 won't decrease.

Fix it by decreasing when iterate over the zspage free list.

Signed-off-by: Chengming Zhou <chengming.zhou@linux.dev>
---
 mm/zsmalloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index fec1a39e5bbe..7fc25fa4e6b3 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1883,6 +1883,7 @@ static void async_free_zspage(struct work_struct *work)
 
 		class = zspage_class(pool, zspage);
 		spin_lock(&class->lock);
+		class_stat_dec(class, ZS_INUSE_RATIO_0, 1);
 		__free_zspage(pool, class, zspage);
 		spin_unlock(&class->lock);
 	}
-- 
2.20.1



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

end of thread, other threads:[~2024-07-01  3:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-27  7:59 [PATCH 1/2] mm/zsmalloc: fix class per-fullness zspage counts Chengming Zhou
2024-06-27  7:59 ` [PATCH 2/2] mm/zsmalloc: move record_obj() into obj_malloc() Chengming Zhou
2024-06-28  2:25   ` Sergey Senozhatsky
2024-06-27 20:33 ` [PATCH 1/2] mm/zsmalloc: fix class per-fullness zspage counts Andrew Morton
2024-06-28  0:51   ` Sergey Senozhatsky
2024-06-28  0:55 ` Sergey Senozhatsky
2024-06-28  1:08   ` Sergey Senozhatsky
2024-06-28  3:19     ` Chengming Zhou
2024-07-01  1:37       ` Sergey Senozhatsky
2024-07-01  2:20         ` Chengming Zhou
2024-07-01  2:49           ` Chengming Zhou
2024-07-01  3:13             ` Sergey Senozhatsky

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