Re: [PATCH v5 01/17] mm/zsmalloc: replace PG_private with pointer comparison
From: Lance Yang
Date: Mon Sep 21 2026 - 02:02:57 EST
On 2026/9/21 10:27, Zi Yan wrote:
zsmalloc uses PG_private to indicate first zpdesc in a zspage chain. It is
equivalent to check zpdesc == zspage->first_zpdesc. Replace
is_first_zpdesc() with zpdesc == zspage->first_zpdesc in obj_allocated().
For get_first_zpdesc(), first_zpdesc is from zspage->first_zpdesc, so
replace is_first_zpdesc() with first_zpdesc->zspage == zspage, the second
requirement of a zspage chain, where all zpdescs point to the same zspage.
is_first_zpdesc(), is only used in VM_BUG_ON_PAGE(), so performance impact
should be negligible. While at it, change VM_BUG_ON() to
VM_WARN_ON_ONCE_PAGE().
It prepares for a future commit that remove PG_private.
No functional change intended.
Assisted-by: LLM
To: Minchan Kim <minchan@xxxxxxxxxx>
To: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
To: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
Signed-off-by: Zi Yan <ziy@xxxxxxxxxx>
---
Nice work! Feel free to add:
Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>