Re: [PATCHv4 6/9] zsmalloc: pass limit on pages per-zspage to zs_create_pool()

From: Sergey Senozhatsky
Date: Wed Nov 09 2022 - 01:24:52 EST


On (22/10/31 14:41), Sergey Senozhatsky wrote:
[..]
> -struct zs_pool *zs_create_pool(const char *name)
> +struct zs_pool *zs_create_pool(const char *name, unsigned long num_pages)
> {
> int i;
> struct zs_pool *pool;
> struct size_class *prev_class = NULL;
> - unsigned long num_pages;
> +
> + if (WARN_ON(num_pages < ZS_MIN_PAGES_PER_ZSPAGE ||
> + num_pages > ZS_MAX_PAGES_PER_ZSPAGE))
> + return NULL;

I tend to think that creating `struct zs_tunables` would be better. For
the time being zs_tunables will contain only one member max_zspage_len,
but it can be extended in the future.