Re: [PATCH v2] zram: add size class equals check into recompression
From: Sergey Senozhatsky
Date: Tue Oct 25 2022 - 22:16:02 EST
On (22/10/25 19:26), Alexey Romanov wrote:
> +/**
> + * zs_lookup_class_index() - Returns index of the zsmalloc &size_class
> + * that hold objects of the provided size.
> + * @pool: zsmalloc pool to use
> + * @size: object size
> + *
> + * Context: Any context.
> + *
> + * Return: the index of the zsmalloc &size_class that hold objects of the
> + * provided size.
> + */
> +unsigned int zs_lookup_class_index(struct zs_pool *pool, unsigned int size)
> +{
> + struct size_class *class;
> +
> + class = pool->size_class[get_size_class_index(pool, size)];
> +
> + return class->index;
> +}
> +EXPORT_SYMBOL_GPL(zs_lookup_class_index);
I cherry-picked it with one tiny tweak: I want this to be ahead of
my series (break dependency on my series). So I removed pool parameter
from `get_size_class_index(pool, size)` in this patch and add it back
in my series (when I change get_size_class_index() prototype).