Loading Documentation/ABI/testing/sysfs-block-zram +39 −0 Original line number Diff line number Diff line Loading @@ -98,3 +98,42 @@ 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. What: /sys/block/zram<id>/idle Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: idle file is write-only and mark zram slot as idle. If system has mounted debugfs, user can see which slots are idle via /sys/kernel/debug/zram/zram<id>/block_state What: /sys/block/zram<id>/writeback Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The writeback file is write-only and trigger idle and/or huge page writeback to backing device. What: /sys/block/zram<id>/bd_stat Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The bd_stat file is read-only and represents backing device's statistics (bd_count, bd_reads, bd_writes) in a format similar to block layer statistics file format. What: /sys/block/zram<id>/writeback_limit_enable Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The writeback_limit_enable file is read-write and specifies eanbe of writeback_limit feature. "1" means eable the feature. No limit "0" is the initial state. What: /sys/block/zram<id>/writeback_limit Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The writeback_limit file is read-write and specifies the maximum amount of writeback ZRAM can do. The limit could be changed in run time. Documentation/ABI/testing/sysfs-fs-f2fs +9 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,15 @@ Contact: "Jaegeuk Kim" <jaegeuk.kim@samsung.com> Description: Controls the number of trials to find a victim segment. What: /sys/fs/f2fs/<disk>/migration_granularity Date: October 2018 Contact: "Chao Yu" <yuchao0@huawei.com> Description: Controls migration granularity of garbage collection on large section, it can let GC move partial segment{s} of one section in one GC cycle, so that dispersing heavy overhead GC to multiple lightweight one. What: /sys/fs/f2fs/<disk>/dir_level Date: March 2014 Contact: "Jaegeuk Kim" <jaegeuk.kim@samsung.com> Loading Documentation/blockdev/zram.txt +105 −21 Original line number Diff line number Diff line Loading @@ -164,11 +164,15 @@ reset WO trigger device reset mem_used_max WO reset the `mem_used_max' counter (see later) mem_limit WO specifies the maximum amount of memory ZRAM can use to store the compressed data writeback_limit WO specifies the maximum amount of write IO zram can write out to backing device as 4KB unit writeback_limit_enable RW show and set writeback_limit feature 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 idle WO mark allocated slot as idle User space is advised to use the following files to read the device statistics. Loading Loading @@ -220,6 +224,17 @@ 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 File /sys/block/zram<id>/bd_stat The stat file represents device's backing device statistics. It consists of a single line of text and contains the following stats separated by whitespace: bd_count size of data written in backing device. Unit: 4K bytes bd_reads the number of reads from backing device Unit: 4K bytes bd_writes the number of writes to backing device Unit: 4K bytes 9) Deactivate: swapoff /dev/zram0 umount /dev/zram1 Loading @@ -237,11 +252,79 @@ line of text and contains the following stats separated by whitespace: = writeback With incompressible pages, there is no memory saving with zram. Instead, with CONFIG_ZRAM_WRITEBACK, zram can write incompressible page With CONFIG_ZRAM_WRITEBACK, zram can write idle/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. To use the feature, admin should set up backing device via "echo /dev/sda5 > /sys/block/zramX/backing_dev" before disksize setting. It supports only partition at this moment. If admin want to use incompressible page writeback, they could do via "echo huge > /sys/block/zramX/write" To use idle page writeback, first, user need to declare zram pages as idle. "echo all > /sys/block/zramX/idle" From now on, any pages on zram are idle pages. The idle mark will be removed until someone request access of the block. IOW, unless there is access request, those pages are still idle pages. Admin can request writeback of those idle pages at right timing via "echo idle > /sys/block/zramX/writeback" With the command, zram writeback idle pages from memory to the storage. If there are lots of write IO with flash device, potentially, it has flash wearout problem so that admin needs to design write limitation to guarantee storage health for entire product life. To overcome the concern, zram supports "writeback_limit" feature. The "writeback_limit_enable"'s default value is 0 so that it doesn't limit any writeback. IOW, if admin want to apply writeback budget, he should enable writeback_limit_enable via $ echo 1 > /sys/block/zramX/writeback_limit_enable Once writeback_limit_enable is set, zram doesn't allow any writeback until admin set the budget via /sys/block/zramX/writeback_limit. (If admin doesn't enable writeback_limit_enable, writeback_limit's value assigned via /sys/block/zramX/writeback_limit is meaninless.) If admin want to limit writeback as per-day 400M, he could do it like below. $ MB_SHIFT=20 $ 4K_SHIFT=12 $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ /sys/block/zram0/writeback_limit. $ echo 1 > /sys/block/zram0/writeback_limit_enable If admin want to allow further write again once the bugdet is exausted, he could do it like below $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ /sys/block/zram0/writeback_limit If admin want to see remaining writeback budget since he set, $ cat /sys/block/zramX/writeback_limit If admin want to disable writeback limit, he could do $ echo 0 > /sys/block/zramX/writeback_limit_enable The writeback_limit count will reset whenever you reset zram(e.g., system reboot, echo 1 > /sys/block/zramX/reset) so keeping how many of writeback happened until you reset the zram to allocate extra writeback budget in next setting is user's job. If admin want to measure writeback count in a certain period, he could know it via /sys/block/zram0/bd_stat's 3rd column. = memory tracking Loading @@ -251,16 +334,17 @@ pages of the process with*pagemap. If you enable the feature, you could see block state via /sys/kernel/debug/zram/zram0/block_state". The output is as follows, 300 75.033841 .wh 301 63.806904 s.. 302 63.806919 ..h 300 75.033841 .wh. 301 63.806904 s... 302 63.806919 ..hi First column is zram's block index. Second column is access time since the system was booted Third column is state of the block. (s: same page w: written page to backing store h: huge page) h: huge page i: idle page) First line of above example says 300th block is accessed at 75.033841sec and the block's state is huge so it is written back to the backing Loading Documentation/filesystems/proc.txt +3 −1 Original line number Diff line number Diff line Loading @@ -499,7 +499,9 @@ manner. The codes are the following: Note that there is no guarantee that every flag and associated mnemonic will be present in all further kernel releases. Things get changed, the flags may be vanished or the reverse -- new added. be vanished or the reverse -- new added. Interpretation of their meaning might change in future as well. So each consumer of these flags has to follow each specific kernel version for the exact semantic. The "Name" field will only be present on a mapping that has been named by userspace, and will show the name passed in by userspace. Loading Makefile +17 −14 Original line number Diff line number Diff line # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 19 SUBLEVEL = 14 SUBLEVEL = 20 EXTRAVERSION = NAME = "People's Front" Loading Loading @@ -487,21 +487,21 @@ endif ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) CLANG_TRIPLE ?= $(CROSS_COMPILE) CLANG_TARGET := --target=$(notdir $(CLANG_TRIPLE:%-=%)) ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_TARGET)), y) CLANG_FLAGS := --target=$(notdir $(CLANG_TRIPLE:%-=%)) ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_FLAGS)), y) $(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?") endif GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),) CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) CLANG_FLAGS += -no-integrated-as KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS endif RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register Loading Loading @@ -1005,11 +1005,6 @@ ifdef CONFIG_STACK_VALIDATION ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else ifdef CONFIG_UNWINDER_ORC $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") else $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") endif SKIP_STACK_VALIDATION := 1 export SKIP_STACK_VALIDATION endif Loading Loading @@ -1166,6 +1161,14 @@ uapi-asm-generic: PHONY += prepare-objtool prepare-objtool: $(objtool_target) ifeq ($(SKIP_STACK_VALIDATION),1) ifdef CONFIG_UNWINDER_ORC @echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 @false else @echo "warning: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 endif endif ifdef cfi-flags ifeq ($(call cc-option, $(cfi-flags)),) Loading Loading
Documentation/ABI/testing/sysfs-block-zram +39 −0 Original line number Diff line number Diff line Loading @@ -98,3 +98,42 @@ 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. What: /sys/block/zram<id>/idle Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: idle file is write-only and mark zram slot as idle. If system has mounted debugfs, user can see which slots are idle via /sys/kernel/debug/zram/zram<id>/block_state What: /sys/block/zram<id>/writeback Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The writeback file is write-only and trigger idle and/or huge page writeback to backing device. What: /sys/block/zram<id>/bd_stat Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The bd_stat file is read-only and represents backing device's statistics (bd_count, bd_reads, bd_writes) in a format similar to block layer statistics file format. What: /sys/block/zram<id>/writeback_limit_enable Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The writeback_limit_enable file is read-write and specifies eanbe of writeback_limit feature. "1" means eable the feature. No limit "0" is the initial state. What: /sys/block/zram<id>/writeback_limit Date: November 2018 Contact: Minchan Kim <minchan@kernel.org> Description: The writeback_limit file is read-write and specifies the maximum amount of writeback ZRAM can do. The limit could be changed in run time.
Documentation/ABI/testing/sysfs-fs-f2fs +9 −0 Original line number Diff line number Diff line Loading @@ -92,6 +92,15 @@ Contact: "Jaegeuk Kim" <jaegeuk.kim@samsung.com> Description: Controls the number of trials to find a victim segment. What: /sys/fs/f2fs/<disk>/migration_granularity Date: October 2018 Contact: "Chao Yu" <yuchao0@huawei.com> Description: Controls migration granularity of garbage collection on large section, it can let GC move partial segment{s} of one section in one GC cycle, so that dispersing heavy overhead GC to multiple lightweight one. What: /sys/fs/f2fs/<disk>/dir_level Date: March 2014 Contact: "Jaegeuk Kim" <jaegeuk.kim@samsung.com> Loading
Documentation/blockdev/zram.txt +105 −21 Original line number Diff line number Diff line Loading @@ -164,11 +164,15 @@ reset WO trigger device reset mem_used_max WO reset the `mem_used_max' counter (see later) mem_limit WO specifies the maximum amount of memory ZRAM can use to store the compressed data writeback_limit WO specifies the maximum amount of write IO zram can write out to backing device as 4KB unit writeback_limit_enable RW show and set writeback_limit feature 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 idle WO mark allocated slot as idle User space is advised to use the following files to read the device statistics. Loading Loading @@ -220,6 +224,17 @@ 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 File /sys/block/zram<id>/bd_stat The stat file represents device's backing device statistics. It consists of a single line of text and contains the following stats separated by whitespace: bd_count size of data written in backing device. Unit: 4K bytes bd_reads the number of reads from backing device Unit: 4K bytes bd_writes the number of writes to backing device Unit: 4K bytes 9) Deactivate: swapoff /dev/zram0 umount /dev/zram1 Loading @@ -237,11 +252,79 @@ line of text and contains the following stats separated by whitespace: = writeback With incompressible pages, there is no memory saving with zram. Instead, with CONFIG_ZRAM_WRITEBACK, zram can write incompressible page With CONFIG_ZRAM_WRITEBACK, zram can write idle/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. To use the feature, admin should set up backing device via "echo /dev/sda5 > /sys/block/zramX/backing_dev" before disksize setting. It supports only partition at this moment. If admin want to use incompressible page writeback, they could do via "echo huge > /sys/block/zramX/write" To use idle page writeback, first, user need to declare zram pages as idle. "echo all > /sys/block/zramX/idle" From now on, any pages on zram are idle pages. The idle mark will be removed until someone request access of the block. IOW, unless there is access request, those pages are still idle pages. Admin can request writeback of those idle pages at right timing via "echo idle > /sys/block/zramX/writeback" With the command, zram writeback idle pages from memory to the storage. If there are lots of write IO with flash device, potentially, it has flash wearout problem so that admin needs to design write limitation to guarantee storage health for entire product life. To overcome the concern, zram supports "writeback_limit" feature. The "writeback_limit_enable"'s default value is 0 so that it doesn't limit any writeback. IOW, if admin want to apply writeback budget, he should enable writeback_limit_enable via $ echo 1 > /sys/block/zramX/writeback_limit_enable Once writeback_limit_enable is set, zram doesn't allow any writeback until admin set the budget via /sys/block/zramX/writeback_limit. (If admin doesn't enable writeback_limit_enable, writeback_limit's value assigned via /sys/block/zramX/writeback_limit is meaninless.) If admin want to limit writeback as per-day 400M, he could do it like below. $ MB_SHIFT=20 $ 4K_SHIFT=12 $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ /sys/block/zram0/writeback_limit. $ echo 1 > /sys/block/zram0/writeback_limit_enable If admin want to allow further write again once the bugdet is exausted, he could do it like below $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \ /sys/block/zram0/writeback_limit If admin want to see remaining writeback budget since he set, $ cat /sys/block/zramX/writeback_limit If admin want to disable writeback limit, he could do $ echo 0 > /sys/block/zramX/writeback_limit_enable The writeback_limit count will reset whenever you reset zram(e.g., system reboot, echo 1 > /sys/block/zramX/reset) so keeping how many of writeback happened until you reset the zram to allocate extra writeback budget in next setting is user's job. If admin want to measure writeback count in a certain period, he could know it via /sys/block/zram0/bd_stat's 3rd column. = memory tracking Loading @@ -251,16 +334,17 @@ pages of the process with*pagemap. If you enable the feature, you could see block state via /sys/kernel/debug/zram/zram0/block_state". The output is as follows, 300 75.033841 .wh 301 63.806904 s.. 302 63.806919 ..h 300 75.033841 .wh. 301 63.806904 s... 302 63.806919 ..hi First column is zram's block index. Second column is access time since the system was booted Third column is state of the block. (s: same page w: written page to backing store h: huge page) h: huge page i: idle page) First line of above example says 300th block is accessed at 75.033841sec and the block's state is huge so it is written back to the backing Loading
Documentation/filesystems/proc.txt +3 −1 Original line number Diff line number Diff line Loading @@ -499,7 +499,9 @@ manner. The codes are the following: Note that there is no guarantee that every flag and associated mnemonic will be present in all further kernel releases. Things get changed, the flags may be vanished or the reverse -- new added. be vanished or the reverse -- new added. Interpretation of their meaning might change in future as well. So each consumer of these flags has to follow each specific kernel version for the exact semantic. The "Name" field will only be present on a mapping that has been named by userspace, and will show the name passed in by userspace. Loading
Makefile +17 −14 Original line number Diff line number Diff line # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 19 SUBLEVEL = 14 SUBLEVEL = 20 EXTRAVERSION = NAME = "People's Front" Loading Loading @@ -487,21 +487,21 @@ endif ifeq ($(cc-name),clang) ifneq ($(CROSS_COMPILE),) CLANG_TRIPLE ?= $(CROSS_COMPILE) CLANG_TARGET := --target=$(notdir $(CLANG_TRIPLE:%-=%)) ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_TARGET)), y) CLANG_FLAGS := --target=$(notdir $(CLANG_TRIPLE:%-=%)) ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_FLAGS)), y) $(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?") endif GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),) CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) CLANG_FLAGS += -no-integrated-as KBUILD_CFLAGS += $(CLANG_FLAGS) KBUILD_AFLAGS += $(CLANG_FLAGS) export CLANG_FLAGS endif RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register Loading Loading @@ -1005,11 +1005,6 @@ ifdef CONFIG_STACK_VALIDATION ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else ifdef CONFIG_UNWINDER_ORC $(error "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") else $(warning "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel") endif SKIP_STACK_VALIDATION := 1 export SKIP_STACK_VALIDATION endif Loading Loading @@ -1166,6 +1161,14 @@ uapi-asm-generic: PHONY += prepare-objtool prepare-objtool: $(objtool_target) ifeq ($(SKIP_STACK_VALIDATION),1) ifdef CONFIG_UNWINDER_ORC @echo "error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 @false else @echo "warning: Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2 endif endif ifdef cfi-flags ifeq ($(call cc-option, $(cfi-flags)),) Loading