linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosryahmed@google.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCHv2 2/6] zsmalloc: remove stat and fullness enums
Date: Thu, 23 Feb 2023 15:32:45 -0800	[thread overview]
Message-ID: <CAJD7tkbezM+pNJkkjhei5EKuXwLnECqfo1m7_aaf-EmPGE9kVQ@mail.gmail.com> (raw)
In-Reply-To: <Y/fyn1u5RhDwgG1J@google.com>

On Thu, Feb 23, 2023 at 3:11 PM Minchan Kim <minchan@kernel.org> wrote:
>
> On Thu, Feb 23, 2023 at 12:04:47PM +0900, Sergey Senozhatsky wrote:
> > The fullness_group enum is nested (sub-enum) within the
> > class_stat_type enum. zsmalloc requires the values in both
> > enums to match, because zsmalloc passes these values to
> > generic functions, e.g. class_stat_inc() and class_stat_dec(),
> > after casting them to integers.
> >
> > Replace these enums (and enum nesting) and use simple defines
> > instead. Also rename some of zsmalloc stats defines, as they
> > sort of clash with zspage object tags.
> >
> > Suggested-by: Yosry Ahmed <yosryahmed@google.com>
> > Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> > ---
> >  mm/zsmalloc.c | 104 ++++++++++++++++++++++----------------------------
> >  1 file changed, 45 insertions(+), 59 deletions(-)
> >
> > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> > index b57a89ed6f30..38ae8963c0eb 100644
> > --- a/mm/zsmalloc.c
> > +++ b/mm/zsmalloc.c
> > @@ -159,26 +159,18 @@
> >  #define ZS_SIZE_CLASSES      (DIV_ROUND_UP(ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE, \
> >                                     ZS_SIZE_CLASS_DELTA) + 1)
> >
> > -enum fullness_group {
> > -     ZS_EMPTY,
> > -     ZS_ALMOST_EMPTY,
> > -     ZS_ALMOST_FULL,
> > -     ZS_FULL,
> > -     NR_ZS_FULLNESS,
> > -};
> > +#define ZS_EMPTY             0
> > +#define ZS_ALMOST_EMPTY              1
> > +#define ZS_ALMOST_FULL               2
> > +#define ZS_FULL                      3
> > +#define ZS_OBJS_ALLOCATED    4
> > +#define ZS_OBJS_INUSE                5
> >
> > -enum class_stat_type {
> > -     CLASS_EMPTY,
> > -     CLASS_ALMOST_EMPTY,
> > -     CLASS_ALMOST_FULL,
> > -     CLASS_FULL,
> > -     OBJ_ALLOCATED,
> > -     OBJ_USED,
> > -     NR_ZS_STAT_TYPE,
> > -};
> > +#define NR_ZS_STAT           6
> > +#define NR_ZS_FULLNESS               4
>
> Using define list instead of enum list looks like going backward. :)
>
> Why can't we do this?
>
> enum class_stat_type {
>     ZS_EMPTY,
>     ZS_ALMOST_EMPTY,
>     ZS_ALMOST_FULL,
>     ZS_FULL,
>     NR_ZS_FULLNESS,
>     ZS_OBJ_ALLOCATED = NR_ZS_FULLNESS,
>     ZS_OBJ_USED,
>     NR_ZS_STAT,
> }

Right, I suggested getting rid of the extra enums, so merging them
into 1 is great.

>
>
> };
> >
> >  struct zs_size_stat {
> > -     unsigned long objs[NR_ZS_STAT_TYPE];
> > +     unsigned long objs[NR_ZS_STAT];
> >  };
> >


  reply	other threads:[~2023-02-23 23:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23  3:04 [PATCHv2 0/6] zsmalloc: fine-grained fullness and new compaction algorithm Sergey Senozhatsky
2023-02-23  3:04 ` [PATCHv2 1/6] zsmalloc: remove insert_zspage() ->inuse optimization Sergey Senozhatsky
2023-02-23 23:09   ` Minchan Kim
2023-02-26  4:40     ` Sergey Senozhatsky
2023-02-23  3:04 ` [PATCHv2 2/6] zsmalloc: remove stat and fullness enums Sergey Senozhatsky
2023-02-23 23:11   ` Minchan Kim
2023-02-23 23:32     ` Yosry Ahmed [this message]
2023-02-26  4:39     ` Sergey Senozhatsky
2023-02-23  3:04 ` [PATCHv2 3/6] zsmalloc: fine-grained inuse ratio based fullness grouping Sergey Senozhatsky
2023-02-23 23:27   ` Minchan Kim
2023-02-26  4:38     ` Sergey Senozhatsky
2023-02-28 22:53       ` Minchan Kim
2023-03-01  4:05         ` Sergey Senozhatsky
2023-03-02  0:13           ` Minchan Kim
2023-03-01  8:55         ` Sergey Senozhatsky
2023-03-02  0:28           ` Minchan Kim
2023-03-02  0:53             ` Sergey Senozhatsky
2023-03-03  0:20               ` Minchan Kim
2023-03-03  1:06                 ` Sergey Senozhatsky
2023-03-03  1:38                   ` Minchan Kim
2023-03-03  1:43                     ` Sergey Senozhatsky
2023-02-23  3:04 ` [PATCHv2 4/6] zsmalloc: rework compaction algorithm Sergey Senozhatsky
2023-02-23 23:46   ` Minchan Kim
2023-02-26  4:09     ` Sergey Senozhatsky
2023-02-28 23:14   ` Minchan Kim
2023-03-01  3:47     ` Sergey Senozhatsky
2023-02-23  3:04 ` [PATCHv2 5/6] zsmalloc: extend compaction statistics Sergey Senozhatsky
2023-02-23 23:51   ` Minchan Kim
2023-02-26  3:55     ` Sergey Senozhatsky
2023-02-28 22:20       ` Minchan Kim
2023-03-01  3:54         ` Sergey Senozhatsky
2023-03-01 23:48           ` Minchan Kim
2023-03-03  1:57             ` Sergey Senozhatsky
2023-02-23  3:04 ` [PATCHv2 6/6] zram: show zsmalloc objs_moved stat in mm_stat Sergey Senozhatsky
2023-02-23 23:53 ` [PATCHv2 0/6] zsmalloc: fine-grained fullness and new compaction algorithm Minchan Kim
2023-02-26  3:50   ` Sergey Senozhatsky
2023-02-28 22:17     ` Minchan Kim
2023-03-01  3:57       ` Sergey Senozhatsky
2023-03-01 23:48         ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJD7tkbezM+pNJkkjhei5EKuXwLnECqfo1m7_aaf-EmPGE9kVQ@mail.gmail.com \
    --to=yosryahmed@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox