[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1512634963-1079-1-git-send-email-gopi.st@samsung.com>
Date: Thu, 7 Dec 2017 13:52:43 +0530
From: Gopi Sai Teja <gopi.st@...sung.com>
To: minchan@...nel.org, ngupta@...are.org,
sergey.senozhatsky.work@...il.com
Cc: linux-kernel@...r.kernel.org, v.narang@...sung.com,
pankaj.m@...sung.com, a.sahrawat@...sung.com,
prakash.a@...sung.com, himanshu.sh@...sung.com,
Gopi Sai Teja <gopi.st@...sung.com>
Subject: [PATCH 1/1] zram: better utilization of zram swap space
If the length of the compressed page is greater than 75% of the PAGE_SIZE,
then the page is stored uncompressed in zram space. Zram space utilization
is improved if the threshold is 80%(5 compressed pages can be stored in
4 pages).
If the compressed length is greater than 3068 and less than 3261, pages
still can be stored in compressed form in zs_malloc class 3264.
Currently these compressed pages belong to 4096 zs malloc class.
Tested on ARM:
Before Patch:
class size obj_allocated obj_used pages_used
190 3072 3820 3819 2865
202 3264 65 63 52
254 4096 11791 11791 11791
Total 65604 64616 29504
After Patch:
class size obj_allocated obj_used pages_used
190 3072 4244 4243 3183
202 3264 1500 1499 1200
254 4096 6306 6306 6306
Total 65983 64896 26628
Signed-off-by: Gopi Sai Teja <gopi.st@...sung.com>
---
drivers/block/zram/zram_drv.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h
index 5ece255..f7d9ddd 100644
--- a/drivers/block/zram/zram_drv.h
+++ b/drivers/block/zram/zram_drv.h
@@ -31,8 +31,12 @@ static const unsigned max_num_devices = 32;
/*
* Pages that compress to size greater than this are stored
* uncompressed in memory.
+ * 16 is zsmalloc class interval and unsigned long is extra memory
+ * used by zsmalloc to store metadata.
*/
-static const size_t max_zpage_size = PAGE_SIZE / 4 * 3;
+
+static const size_t max_zpage_size = round_down((PAGE_SIZE / 5 * 4), 16)
+ - sizeof(unsigned long);
/*
* NOTE: max_zpage_size must be less than or equal to:
--
1.9.1
Powered by blists - more mailing lists