From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757319AbbDPL5l (ORCPT ); Thu, 16 Apr 2015 07:57:41 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:32949 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757060AbbDPL4L (ORCPT ); Thu, 16 Apr 2015 07:56:11 -0400 From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: [PATCHv2 06/10] zram: remove max_num_devices limitation Date: Thu, 16 Apr 2015 20:55:52 +0900 Message-Id: <1429185356-11096-7-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.4.0.rc2 In-Reply-To: <1429185356-11096-1-git-send-email-sergey.senozhatsky@gmail.com> References: <1429185356-11096-1-git-send-email-sergey.senozhatsky@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Limiting the number of zram devices to 32 (default max_num_devices value) is confusing, let's drop it. A user with 2TB or 4TB of RAM, for example, can request as many devices as he can handle. Signed-off-by: Sergey Senozhatsky --- Documentation/blockdev/zram.txt | 8 +++++++- drivers/block/zram/zram_drv.c | 8 +------- drivers/block/zram/zram_drv.h | 6 ------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Documentation/blockdev/zram.txt b/Documentation/blockdev/zram.txt index bef4998..2ccc741 100644 --- a/Documentation/blockdev/zram.txt +++ b/Documentation/blockdev/zram.txt @@ -19,7 +19,9 @@ Following shows a typical sequence of steps for using zram. 1) Load Module: modprobe zram num_devices=4 This creates 4 devices: /dev/zram{0,1,2,3} - (num_devices parameter is optional. Default: 1) + +num_devices parameter is optional and tells zram how many devices should be +pre-created. Default: 1. 2) Set max number of compression streams Compression backend may use up to max_comp_streams compression streams, @@ -128,6 +130,7 @@ mem_limit RW the maximum amount of memory ZRAM can use to store num_migrated RO the number of objects migrated migrated by compaction compact WO trigger memory compaction + WARNING ======= per-stat sysfs attributes are considered to be deprecated. @@ -149,6 +152,7 @@ File /sys/block/zram/stat Represents block layer statistics. Read Documentation/block/stat.txt for details. + File /sys/block/zram/io_stat The stat file represents device's I/O statistics not accounted by block @@ -160,6 +164,7 @@ whitespace: invalid_io notify_free + File /sys/block/zram/mm_stat The stat file represents device's mm statistics. It consists of a single @@ -172,6 +177,7 @@ line of text and contains the following stats separated by whitespace: zero_pages num_migrated + 8) Deactivate: swapoff /dev/zram0 umount /dev/zram1 diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index e526fe1..c2d9b76 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1288,12 +1288,6 @@ static int __init zram_init(void) { int ret, dev_id; - if (num_devices > max_num_devices) { - pr_warn("Invalid value for num_devices: %u\n", - num_devices); - return -EINVAL; - } - zram_major = register_blkdev(0, "zram"); if (zram_major <= 0) { pr_warn("Unable to get major number\n"); @@ -1323,7 +1317,7 @@ module_init(zram_init); module_exit(zram_exit); module_param(num_devices, uint, 0); -MODULE_PARM_DESC(num_devices, "Number of zram devices"); +MODULE_PARM_DESC(num_devices, "Number of pre-created zram devices"); MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Nitin Gupta "); diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index 570c598..042994e 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h @@ -20,12 +20,6 @@ #include "zcomp.h" -/* - * Some arbitrary value. This is just to catch - * invalid value for num_devices module parameter. - */ -static const unsigned max_num_devices = 32; - /*-- Configurable parameters */ /* -- 2.4.0.rc2