Re: [PATCH v2 04/11] zsmalloc: switch handle type to struct zs_handle
From: Yosry Ahmed
Date: Tue Nov 10 2026 - 11:46:09 EST
On Tue, Nov 10, 2026 at 02:48:09PM +0900, Sergey Senozhatsky wrote:
> zsmalloc handle is an unsigned long that holds an address of a
> handle_cachep object, so zsmalloc and its users have to cast it
> back and forth. Introduce struct zs_handle and switch zsmalloc,
> zram and zswap to struct zs_handle pointers. Functions that only
> read the handle take a const pointer.
>
> This is a preparation for embedding struct zs_handle into zram and
> zswap entries. No functional change.
>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
> ---
> drivers/block/zram/zram_drv.c | 28 ++++++------
> drivers/block/zram/zram_drv.h | 2 +-
> include/linux/zsmalloc.h | 13 +++---
> mm/zsmalloc.c | 85 +++++++++++++++++++----------------
> mm/zswap.c | 8 ++--
zsmalloc and zswap changes LGTM with a small nit below:
Reviewed-by: Yosry Ahmed <yosry@xxxxxxxxxx>
[..]
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index dab71f582103..3a6a7253fd01 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -264,6 +264,10 @@ struct link_free {
> };
> };
>
> +struct zs_handle {
> + unsigned long __private obj;
> +};
nit: Update the definition of ZS_HANDLE_SIZE to sizeof(zs_handle)?