mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Yisheng Xie <xieyisheng1@huawei.com>
Cc: akpm@linux-foundation.org, minchan@kernel.org, ngupta@vflare.org,
	sergey.senozhatsky.work@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] zram: fix compr_data_size stat
Date: Fri, 11 Aug 2017 10:35:53 +0900	[thread overview]
Message-ID: <20170811013553.GB520@jagdpanzerIV.localdomain> (raw)
In-Reply-To: <1502413832-13560-1-git-send-email-xieyisheng1@huawei.com>

On (08/11/17 09:10), Yisheng Xie wrote:
> The compr_data_size is a stat for compressed size of pages stored, which
> should add comp_len when we compresse a page.
> 
> Meanwhile fix typos in comment:
> * ZRAM_SAME means page consists the same element not the entirely zero page
> * read_from_bdev_async() return 1 to avoid call page_endio() in zram_rw_page()
> 
> Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

> ---
>  drivers/block/zram/zram_drv.c | 3 ++-
>  drivers/block/zram/zram_drv.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index e27daca..b2b75b1 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -455,7 +455,7 @@ void zram_page_end_io(struct bio *bio)
>  }
>  
>  /*
> - * Returns 0 if the submission is successful.
> + * Returns 1 if the submission is successful.
>   */
>  static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
>  			unsigned long entry, struct bio *parent)

ok.


> @@ -1073,6 +1073,7 @@ static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
>  	}  else {
>  		zram_set_handle(zram, index, handle);
>  		zram_set_obj_size(zram, index, comp_len);
> +		atomic64_add(comp_len, &zram->stats.compr_data_size);

hm. looks like nothing increments ->compr_data_size as of now... we only
decrement it. so it's possible to have something like

# cat /sys/block/zram0/mm_stat 

163594240 18446744073709549720 80388096        0 80388096    15927        0

oops... good catch.


>  	}
>  	zram_slot_unlock(zram, index);
>  
> diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
> index 5573dc2..31762db 100644
> --- a/drivers/block/zram/zram_drv.h
> +++ b/drivers/block/zram/zram_drv.h
> @@ -60,7 +60,7 @@
>  
>  /* Flags for zram pages (table[page_no].value) */
>  enum zram_pageflags {
> -	/* Page consists entirely of zeros */
> +	/* Page consists the same element */
>  	ZRAM_SAME = ZRAM_FLAG_SHIFT,
>  	ZRAM_ACCESS,	/* page is now accessed */
>  	ZRAM_WB,	/* page is stored on backing_device */

ok.

	-ss

  reply	other threads:[~2017-08-11  1:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11  1:10 Yisheng Xie
2017-08-11  1:35 ` Sergey Senozhatsky [this message]
2017-08-11  1:38   ` Sergey Senozhatsky
2017-08-11  2:07     ` Yisheng Xie
2017-08-11  3:00       ` Yisheng Xie
2017-08-14  8:08 ` Minchan Kim
2017-08-14  9:24   ` Yisheng Xie
2017-08-14  9:34     ` Minchan Kim
2017-08-14 10:53       ` Yisheng Xie

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=20170811013553.GB520@jagdpanzerIV.localdomain \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=xieyisheng1@huawei.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

all inboxes | Powered by JetHome®