UPSTREAM: zram: add config and doc file for writeback feature
authorMinchan Kim <minchan@kernel.org>
Wed, 6 Sep 2017 23:20:10 +0000 (16:20 -0700)
committerivanmeler <i_ivan@windowslive.com>
Wed, 13 Apr 2022 21:13:25 +0000 (21:13 +0000)
This patch adds document and kconfig for using of writeback feature.

Link: http://lkml.kernel.org/r/1498459987-24562-10-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Juneho Choi <juno.choi@lge.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 5a47074f0279421778f97b1b1e75686696a5f42a)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I9ec2230739a6468a4481a90a9c9f966badf9ac48

Documentation/ABI/testing/sysfs-block-zram
Documentation/blockdev/zram.txt
drivers/block/zram/Kconfig

index 451b6d882b2c182af1e9ce9b28bcd73b1218ae26..c1513c756af125ce5adb76ee8e4522e25572a099 100644 (file)
@@ -90,3 +90,11 @@ Description:
                device's debugging info useful for kernel developers. Its
                format is not documented intentionally and may change
                anytime without any notice.
+
+What:          /sys/block/zram<id>/backing_dev
+Date:          June 2017
+Contact:       Minchan Kim <minchan@kernel.org>
+Description:
+               The backing_dev file is read-write and set up backing
+               device for zram to write incompressible pages.
+               For using, user should enable CONFIG_ZRAM_WRITEBACK.
index 4fced8a21307517d82b77329aa1705c7569787eb..257e65714c6a216f3fce9ebce7398eb821f96176 100644 (file)
@@ -168,6 +168,7 @@ max_comp_streams  RW    the number of possible concurrent compress operations
 comp_algorithm    RW    show and change the compression algorithm
 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
 
 
 User space is advised to use the following files to read the device statistics.
@@ -231,5 +232,15 @@ line of text and contains the following stats separated by whitespace:
        resets the disksize to zero. You must set the disksize again
        before reusing the device.
 
+* Optional Feature
+
+= writeback
+
+With incompressible pages, there is no memory saving with zram.
+Instead, with CONFIG_ZRAM_WRITEBACK, zram can write incompressible page
+to backing storage rather than keeping it in memory.
+User should set up backing device via /sys/block/zramX/backing_dev
+before disksize setting.
+
 Nitin Gupta
 ngupta@vflare.org
index b8ecba6dcd3b8669b01cc537a0027f86e2d8b10c..7cd4a8ec3c8fa24b827a19004179f1231b8c2999 100644 (file)
@@ -13,3 +13,15 @@ config ZRAM
          disks and maybe many more.
 
          See zram.txt for more information.
+
+config ZRAM_WRITEBACK
+       bool "Write back incompressible page to backing device"
+       depends on ZRAM
+       default n
+       help
+        With incompressible page, there is no memory saving to keep it
+        in memory. Instead, write it out to backing device.
+        For this feature, admin should set up backing device via
+        /sys/block/zramX/backing_dev.
+
+        See zram.txt for more infomration.