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

From: Minchan Kim
Date: Fri Nov 11 2022 - 12:14:54 EST


On Wed, Nov 09, 2022 at 03:24:43PM +0900, Sergey Senozhatsky wrote:
> 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.

+1 zs_tunables if we go that way.