linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
	"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Nitin Gupta <ngupta@vflare.org>
Subject: Re: [PATCH] driver: zram: fix wrong counting on pages_store
Date: Tue, 27 Jul 2021 09:32:24 +0800	[thread overview]
Message-ID: <CAGWkznFifWQSMAoz-qD2M_qnZL=qi8XsJPVxet6Cbt_euD4eAg@mail.gmail.com> (raw)
In-Reply-To: <YP72sNSOVwgnQzqo@google.com>

On Tue, Jul 27, 2021 at 1:53 AM Minchan Kim <minchan@kernel.org> wrote:
>
> On Mon, Jul 26, 2021 at 10:27:40AM +0900, Sergey Senozhatsky wrote:
> > On (21/07/20 14:47), Huangzhaoyang wrote:
> > > It makes the statistic confused when counting pages_store in during writeback.
> > > pages_store should just reflect the swapped pages on ZRAM, while bd_writes be
> > > responsible for writeback things.
> > >
> > > Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> > > ---
> > >  drivers/block/zram/zram_drv.c | 1 -
> > >  1 file changed, 1 deletion(-)
> > >
> > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> > > index cf8deec..6bdaa9d 100644
> > > --- a/drivers/block/zram/zram_drv.c
> > > +++ b/drivers/block/zram/zram_drv.c
> > > @@ -765,7 +765,6 @@ static ssize_t writeback_store(struct device *dev,
> > >             zram_set_flag(zram, index, ZRAM_WB);
> > >             zram_set_element(zram, index, blk_idx);
> > >             blk_idx = 0;
> > > -           atomic64_inc(&zram->stats.pages_stored);
> >
> > Yeah, I think we don't need it here.
> >
> > Minchan, what do you think?
>
> What pages_stored currently represents is orig_data_size from mm_stat
>
>  ================ =============================================================
>  orig_data_size   uncompressed size of data stored in this disk.
>                   Unit: bytes
>
> Thus, if we don't increase it after zram_free_page, it loses what's
> the original data size which would be important to calculate
> compression ratio along with compr_data_size.
zram_free_page??  What the commit try to fix is pages_stored being
increased incorrectly in writeback_store, which will lead to wrong
statistic on orig size of ZRAM.

  reply	other threads:[~2021-07-27  1:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  6:47 Huangzhaoyang
2021-07-25  1:19 ` [Resend PATCH] " Zhaoyang Huang
2021-07-26  1:27 ` [PATCH] " Sergey Senozhatsky
2021-07-26 17:53   ` Minchan Kim
2021-07-27  1:32     ` Zhaoyang Huang [this message]
2021-07-27  5:45       ` Zhaoyang Huang

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='CAGWkznFifWQSMAoz-qD2M_qnZL=qi8XsJPVxet6Cbt_euD4eAg@mail.gmail.com' \
    --to=huangzhaoyang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=senozhatsky@chromium.org \
    --cc=zhaoyang.huang@unisoc.com \
    --subject='Re: [PATCH] driver: zram: fix wrong counting on pages_store' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).