[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230418062503.62121-6-avromanov@sberdevices.ru>
Date: Tue, 18 Apr 2023 09:25:03 +0300
From: Alexey Romanov <avromanov@...rdevices.ru>
To: <minchan@...nel.org>, <senozhatsky@...omium.org>,
<akpm@...ux-foundation.org>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<kernel@...rdevices.ru>, Alexey Romanov <avromanov@...rdevices.ru>
Subject: [RFC PATCH v1 5/5] zram: add pages_folded to stats
This counter show how many objects folded into single one
at the zsmalloc allocator level.
Signed-off-by: Alexey Romanov <avromanov@...rdevices.ru>
---
Documentation/admin-guide/blockdev/zram.rst | 2 ++
drivers/block/zram/zram_drv.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/blockdev/zram.rst b/Documentation/admin-guide/blockdev/zram.rst
index e4551579cb12..349f13a2d310 100644
--- a/Documentation/admin-guide/blockdev/zram.rst
+++ b/Documentation/admin-guide/blockdev/zram.rst
@@ -209,6 +209,7 @@ compact WO trigger memory compaction
debug_stat RO this file is used for zram debugging purposes
backing_dev RW set up backend storage for zram to write out
idle WO mark allocated slot as idle
+fold WO trigger memory folding
====================== ====== ===============================================
@@ -267,6 +268,7 @@ line of text and contains the following stats separated by whitespace:
pages_compacted the number of pages freed during compaction
huge_pages the number of incompressible pages
huge_pages_since the number of incompressible pages since zram set up
+ pages_folded the number of pages freed during folding
================ =============================================================
File /sys/block/zram<id>/bd_stat
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 06a614d1643d..3012b297ade5 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1242,7 +1242,7 @@ static ssize_t mm_stat_show(struct device *dev,
max_used = atomic_long_read(&zram->stats.max_used_pages);
ret = scnprintf(buf, PAGE_SIZE,
- "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu\n",
+ "%8llu %8llu %8llu %8lu %8ld %8llu %8lu %8llu %8llu %8lu\n",
orig_size << PAGE_SHIFT,
(u64)atomic64_read(&zram->stats.compr_data_size),
mem_used << PAGE_SHIFT,
@@ -1251,7 +1251,8 @@ static ssize_t mm_stat_show(struct device *dev,
(u64)atomic64_read(&zram->stats.same_pages),
atomic_long_read(&pool_stats.pages_compacted),
(u64)atomic64_read(&zram->stats.huge_pages),
- (u64)atomic64_read(&zram->stats.huge_pages_since));
+ (u64)atomic64_read(&zram->stats.huge_pages_since),
+ atomic_long_read(&pool_stats.pages_folded));
up_read(&zram->init_lock);
return ret;
--
2.38.1
Powered by blists - more mailing lists