Re: [PATCH 2/2] mm/zsmalloc: move record_obj() into obj_malloc()

From: Sergey Senozhatsky
Date: Thu Jun 27 2024 - 22:25:12 EST


On (24/06/27 15:59), Chengming Zhou wrote:
> We always record_obj() to make handle points to object after obj_malloc(),
> so simplify the code by moving record_obj() into obj_malloc(). There
> should be no functional change.
>
> Signed-off-by: Chengming Zhou <chengming.zhou@xxxxxxxxx>

I guess I don't have a strong opinion on that.

FWIW
Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>

[..]
> @@ -1591,7 +1589,6 @@ static void migrate_zspage(struct zs_pool *pool, struct zspage *src_zspage,
> free_obj = obj_malloc(pool, dst_zspage, handle);
> zs_object_copy(class, free_obj, used_obj);
> obj_idx++;
> - record_obj(handle, free_obj);
> obj_free(class->size, used_obj);

I sort of like how here we would copy the object first and then record it,
some sort of "commit" stage. But I don't see any issues with the new code.