1e98419c2SNitin GuptaWhat: /sys/block/zram<id>/disksize 2e98419c2SNitin GuptaDate: August 2010 3e98419c2SNitin GuptaContact: Nitin Gupta <ngupta@vflare.org> 4e98419c2SNitin GuptaDescription: 5e98419c2SNitin Gupta The disksize file is read-write and specifies the disk size 6e98419c2SNitin Gupta which represents the limit on the *uncompressed* worth of data 7e98419c2SNitin Gupta that can be stored in this disk. 851d8a7b0SBernhard M. Wiedemann Unit: bytes 9e98419c2SNitin Gupta 10e98419c2SNitin GuptaWhat: /sys/block/zram<id>/initstate 11e98419c2SNitin GuptaDate: August 2010 12e98419c2SNitin GuptaContact: Nitin Gupta <ngupta@vflare.org> 13e98419c2SNitin GuptaDescription: 1451d8a7b0SBernhard M. Wiedemann The initstate file is read-only and shows the initialization 15e98419c2SNitin Gupta state of the device. 16e98419c2SNitin Gupta 17e98419c2SNitin GuptaWhat: /sys/block/zram<id>/reset 18e98419c2SNitin GuptaDate: August 2010 19e98419c2SNitin GuptaContact: Nitin Gupta <ngupta@vflare.org> 20e98419c2SNitin GuptaDescription: 2151d8a7b0SBernhard M. Wiedemann The reset file is write-only and allows resetting the 2251d8a7b0SBernhard M. Wiedemann device. The reset operation frees all the memory associated 23e98419c2SNitin Gupta with this device. 24e98419c2SNitin Gupta 25e46b8a03SSergey SenozhatskyWhat: /sys/block/zram<id>/comp_algorithm 26e46b8a03SSergey SenozhatskyDate: February 2014 27e46b8a03SSergey SenozhatskyContact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> 28e46b8a03SSergey SenozhatskyDescription: 29e46b8a03SSergey Senozhatsky The comp_algorithm file is read-write and lets to show 30e46b8a03SSergey Senozhatsky available and selected compression algorithms, change 31e46b8a03SSergey Senozhatsky compression algorithm selection. 32e46b8a03SSergey Senozhatsky 33461a8eeeSMinchan KimWhat: /sys/block/zram<id>/mem_used_max 34461a8eeeSMinchan KimDate: August 2014 35461a8eeeSMinchan KimContact: Minchan Kim <minchan@kernel.org> 36461a8eeeSMinchan KimDescription: 37c87d1655SSergey Senozhatsky The mem_used_max file is write-only and is used to reset 38c87d1655SSergey Senozhatsky the counter of maximum memory zram have consumed to store 39c87d1655SSergey Senozhatsky compressed data. For resetting the value, you should write 40c87d1655SSergey Senozhatsky "0". Otherwise, you could see -EINVAL. 41461a8eeeSMinchan Kim Unit: bytes 42461a8eeeSMinchan Kim 439ada9da9SMinchan KimWhat: /sys/block/zram<id>/mem_limit 449ada9da9SMinchan KimDate: August 2014 459ada9da9SMinchan KimContact: Minchan Kim <minchan@kernel.org> 469ada9da9SMinchan KimDescription: 47c87d1655SSergey Senozhatsky The mem_limit file is write-only and specifies the maximum 48c87d1655SSergey Senozhatsky amount of memory ZRAM can use to store the compressed data. 49c87d1655SSergey Senozhatsky The limit could be changed in run time and "0" means disable 50c87d1655SSergey Senozhatsky the limit. No limit is the initial state. Unit: bytes 514e3ba878SMinchan Kim 524e3ba878SMinchan KimWhat: /sys/block/zram<id>/compact 534e3ba878SMinchan KimDate: August 2015 544e3ba878SMinchan KimContact: Minchan Kim <minchan@kernel.org> 554e3ba878SMinchan KimDescription: 564e3ba878SMinchan Kim The compact file is write-only and trigger compaction for 574e3ba878SMinchan Kim allocator zrm uses. The allocator moves some objects so that 584e3ba878SMinchan Kim it could free fragment space. 592f6a3bedSSergey Senozhatsky 602f6a3bedSSergey SenozhatskyWhat: /sys/block/zram<id>/io_stat 612f6a3bedSSergey SenozhatskyDate: August 2015 622f6a3bedSSergey SenozhatskyContact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> 632f6a3bedSSergey SenozhatskyDescription: 642f6a3bedSSergey Senozhatsky The io_stat file is read-only and accumulates device's I/O 652f6a3bedSSergey Senozhatsky statistics not accounted by block layer. For example, 662f6a3bedSSergey Senozhatsky failed_reads, failed_writes, etc. File format is similar to 672f6a3bedSSergey Senozhatsky block layer statistics file format. 684f2109f6SSergey Senozhatsky 694f2109f6SSergey SenozhatskyWhat: /sys/block/zram<id>/mm_stat 704f2109f6SSergey SenozhatskyDate: August 2015 714f2109f6SSergey SenozhatskyContact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> 724f2109f6SSergey SenozhatskyDescription: 734f2109f6SSergey Senozhatsky The mm_stat file is read-only and represents device's mm 744f2109f6SSergey Senozhatsky statistics (orig_data_size, compr_data_size, etc.) in a format 754f2109f6SSergey Senozhatsky similar to block layer statistics file format. 76623e47fcSSergey Senozhatsky 77623e47fcSSergey SenozhatskyWhat: /sys/block/zram<id>/debug_stat 78623e47fcSSergey SenozhatskyDate: July 2016 79623e47fcSSergey SenozhatskyContact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> 80623e47fcSSergey SenozhatskyDescription: 81623e47fcSSergey Senozhatsky The debug_stat file is read-only and represents various 82623e47fcSSergey Senozhatsky device's debugging info useful for kernel developers. Its 83623e47fcSSergey Senozhatsky format is not documented intentionally and may change 84623e47fcSSergey Senozhatsky anytime without any notice. 855a47074fSMinchan Kim 865a47074fSMinchan KimWhat: /sys/block/zram<id>/backing_dev 875a47074fSMinchan KimDate: June 2017 885a47074fSMinchan KimContact: Minchan Kim <minchan@kernel.org> 895a47074fSMinchan KimDescription: 905a47074fSMinchan Kim The backing_dev file is read-write and set up backing 915a47074fSMinchan Kim device for zram to write incompressible pages. 925a47074fSMinchan Kim For using, user should enable CONFIG_ZRAM_WRITEBACK. 93e82592c4SMinchan Kim 94e82592c4SMinchan KimWhat: /sys/block/zram<id>/idle 95e82592c4SMinchan KimDate: November 2018 96e82592c4SMinchan KimContact: Minchan Kim <minchan@kernel.org> 97e82592c4SMinchan KimDescription: 98e82592c4SMinchan Kim idle file is write-only and mark zram slot as idle. 99e82592c4SMinchan Kim If system has mounted debugfs, user can see which slots 100e82592c4SMinchan Kim are idle via /sys/kernel/debug/zram/zram<id>/block_state 101a939888eSMinchan Kim 102a939888eSMinchan KimWhat: /sys/block/zram<id>/writeback 103a939888eSMinchan KimDate: November 2018 104a939888eSMinchan KimContact: Minchan Kim <minchan@kernel.org> 105a939888eSMinchan KimDescription: 106a939888eSMinchan Kim The writeback file is write-only and trigger idle and/or 107a939888eSMinchan Kim huge page writeback to backing device. 10823eddf39SMinchan Kim 10923eddf39SMinchan KimWhat: /sys/block/zram<id>/bd_stat 11023eddf39SMinchan KimDate: November 2018 11123eddf39SMinchan KimContact: Minchan Kim <minchan@kernel.org> 11223eddf39SMinchan KimDescription: 11323eddf39SMinchan Kim The bd_stat file is read-only and represents backing device's 11423eddf39SMinchan Kim statistics (bd_count, bd_reads, bd_writes) in a format 11523eddf39SMinchan Kim similar to block layer statistics file format. 116bb416d18SMinchan Kim 1171d69a3f8SMinchan KimWhat: /sys/block/zram<id>/writeback_limit_enable 1181d69a3f8SMinchan KimDate: November 2018 1191d69a3f8SMinchan KimContact: Minchan Kim <minchan@kernel.org> 1201d69a3f8SMinchan KimDescription: 1211d69a3f8SMinchan Kim The writeback_limit_enable file is read-write and specifies 1221d69a3f8SMinchan Kim eanbe of writeback_limit feature. "1" means eable the feature. 1231d69a3f8SMinchan Kim No limit "0" is the initial state. 1241d69a3f8SMinchan Kim 125bb416d18SMinchan KimWhat: /sys/block/zram<id>/writeback_limit 126bb416d18SMinchan KimDate: November 2018 127bb416d18SMinchan KimContact: Minchan Kim <minchan@kernel.org> 128bb416d18SMinchan KimDescription: 129bb416d18SMinchan Kim The writeback_limit file is read-write and specifies the maximum 130bb416d18SMinchan Kim amount of writeback ZRAM can do. The limit could be changed 1311d69a3f8SMinchan Kim in run time. 132c959a0e8SSergey Senozhatsky 133c959a0e8SSergey SenozhatskyWhat: /sys/block/zram<id>/recomp_algorithm 134c959a0e8SSergey SenozhatskyDate: November 2022 135c959a0e8SSergey SenozhatskyContact: Sergey Senozhatsky <senozhatsky@chromium.org> 136c959a0e8SSergey SenozhatskyDescription: 137c959a0e8SSergey Senozhatsky The recomp_algorithm file is read-write and allows to set 138c959a0e8SSergey Senozhatsky or show secondary compression algorithms. 139c959a0e8SSergey Senozhatsky 140c959a0e8SSergey SenozhatskyWhat: /sys/block/zram<id>/recompress 141c959a0e8SSergey SenozhatskyDate: November 2022 142c959a0e8SSergey SenozhatskyContact: Sergey Senozhatsky <senozhatsky@chromium.org> 143c959a0e8SSergey SenozhatskyDescription: 144c959a0e8SSergey Senozhatsky The recompress file is write-only and triggers re-compression 145c959a0e8SSergey Senozhatsky with secondary compression algorithms. 146*4eac9321SSergey Senozhatsky 147*4eac9321SSergey SenozhatskyWhat: /sys/block/zram<id>/algorithm_params 148*4eac9321SSergey SenozhatskyDate: August 2024 149*4eac9321SSergey SenozhatskyContact: Sergey Senozhatsky <senozhatsky@chromium.org> 150*4eac9321SSergey SenozhatskyDescription: 151*4eac9321SSergey Senozhatsky The algorithm_params file is write-only and is used to setup 152*4eac9321SSergey Senozhatsky compression algorithm parameters. 153