From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
kernel-team <kernel-team@lge.com>,
Minchan Kim <minchan@kernel.org>
Subject: [PATCH 1/2] zram: count same page write as page_stored
Date: Mon, 15 May 2017 16:41:07 +0900 [thread overview]
Message-ID: <1494834068-27004-1-git-send-email-minchan@kernel.org> (raw)
Regardless of whether it is same page or not, it's surely write
and stored to zram so we should increase pages_stored stat.
Otherwise, user can see zero value via mm_stats although he
writes a lot of pages to zram.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/block/zram/zram_drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 372602c7da49..b885356551e9 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -516,6 +516,7 @@ static bool zram_same_page_write(struct zram *zram, u32 index,
zram_slot_unlock(zram, index);
atomic64_inc(&zram->stats.same_pages);
+ atomic64_inc(&zram->stats.pages_stored);
return true;
}
kunmap_atomic(mem);
@@ -619,6 +620,7 @@ static void zram_free_page(struct zram *zram, size_t index)
zram_clear_flag(zram, index, ZRAM_SAME);
zram_set_element(zram, index, 0);
atomic64_dec(&zram->stats.same_pages);
+ atomic64_dec(&zram->stats.pages_stored);
return;
}
--
2.7.4
next reply other threads:[~2017-05-15 7:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-15 7:41 Minchan Kim [this message]
2017-05-15 7:41 ` [PATCH 2/2] zram: do not count duplicated pages as compressed Minchan Kim
2017-05-16 1:30 ` Sergey Senozhatsky
2017-05-16 1:59 ` Minchan Kim
2017-05-16 2:36 ` Sergey Senozhatsky
2017-05-16 5:26 ` Minchan Kim
2017-05-16 5:45 ` Sergey Senozhatsky
2017-05-16 7:16 ` Minchan Kim
2017-05-16 7:36 ` Sergey Senozhatsky
2017-05-17 8:32 ` Minchan Kim
2017-05-17 9:14 ` Sergey Senozhatsky
2017-05-18 4:53 ` Minchan Kim
2017-05-21 7:04 ` Christoph Hellwig
2017-05-21 7:15 ` Minchan Kim
2017-05-16 1:11 ` [PATCH 1/2] zram: count same page write as page_stored Sergey Senozhatsky
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=1494834068-27004-1-git-send-email-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=kernel-team@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky@gmail.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