From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Yosry Ahmed <yosryahmed@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCHv2 3/6] zsmalloc: fine-grained inuse ratio based fullness grouping
Date: Thu, 2 Mar 2023 16:20:43 -0800 [thread overview]
Message-ID: <ZAE9W5xQmQecUzhj@google.com> (raw)
In-Reply-To: <Y//zbxEmAmoA69ed@google.com>
On Thu, Mar 02, 2023 at 09:53:03AM +0900, Sergey Senozhatsky wrote:
> On (23/03/01 16:28), Minchan Kim wrote:
> > On Wed, Mar 01, 2023 at 05:55:44PM +0900, Sergey Senozhatsky wrote:
> > > On (23/02/28 14:53), Minchan Kim wrote:
> > > > BTW, I still prefer the enum instead of 10 define.
> > > >
> > > > enum fullness_group {
> > > > ZS_EMPTY,
> > > > ZS_INUSE_RATIO_MIN,
> > > > ZS_INUSE_RATIO_ALMOST_FULL = 7,
> > > > ZS_INUSE_RATIO_MAX = 10,
> > > > ZS_FULL,
> > > > NR_ZS_FULLNESS,
> > > > }
> > >
> > > For educational purposes, may I ask what do enums give us? We
> > > always use integers - int:4 in zspage fullness, int for arrays
> > > offsets and we cast to plain integers in get/set stats. So those
> > > enums exist only at declaration point, and plain int otherwise.
> > > What are the benefits over #defines?
> >
> > Well, I just didn't like the 12 hard coded define *list* values
> > and never used other places except zs_stats_size_show since
>
> If we have two enums, then we need more lines
>
> enum fullness {
> ZS_INUSE_RATIO_0
> ...
> ZS_INUSE_RATIO_100
> }
>
> enum stats {
> INUSE_RATIO_0
> ...
> INUSE_RATIO_100
>
> // the rest of stats
> }
>
> and then we use int:4 fullness value to access stats.
Yeah. I don't see any problem unless I miss your point.
>
> > I thought we could handle zs_stats_size_show in the loop without
> > the specific each ratio definary.
>
> For per inuse ratio zs_stats_size_show() we need to access stats
> individually:
>
> inuse10, inuse20, inuse30, ... inuse99
Does it need specific index in the enum list?
I don't mind having all the hard coded index if it's *necessary*
but wanted to try we could make the index with base + index
on demand in the loop via simple arithmetic.
next prev parent reply other threads:[~2023-03-03 0:20 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
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 [this message]
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=ZAE9W5xQmQecUzhj@google.com \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=senozhatsky@chromium.org \
--cc=yosryahmed@google.com \
/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