[PATCH] mm: zsmalloc: update the comment about pool lock

From: Barry Song (Xiaomi)

Date: Fri Jul 24 2026 - 23:45:09 EST


Update the comment to reflect that `zs_free()` can be lockless when
`ZS_OBJ_CLASS_BITS` applies.

Suggested-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/zsmalloc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 3d566a3ee96f..b5eadee0e8f0 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1865,8 +1865,8 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
pool = zspage->pool;

/*
- * The pool migrate_lock protects the race between zpage migration
- * and zs_free.
+ * The pool migrate_lock protects against races between zpage migration
+ * and zs_free(), but only when ZS_OBJ_CLASS_BITS does not apply.
*/
write_lock(&pool->lock);
class = zspage_class(pool, zspage);
@@ -2045,8 +2045,9 @@ static unsigned long __zs_compact(struct zs_pool *pool,
unsigned long pages_freed = 0;

/*
- * protect the race between zpage migration and zs_free
- * as well as zpage allocation/free
+ * Protect against races between zpage migration and zs_free()
+ * (only when ZS_OBJ_CLASS_BITS does not apply), as well as
+ * zpage allocation and free.
*/
write_lock(&pool->lock);
spin_lock(&class->lock);
--
2.39.3 (Apple Git-146)