Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d613313 authored by Blagovest Kolenichev's avatar Blagovest Kolenichev
Browse files

Merge android-4.14 (a895cea2) into msm-4.14



* refs/heads/tmp-a895cea2:
  Revert "ANDROID: sched: Fix share_cap_level detect"
  ANDROID: cuttlefish_defconfig: Add support for AC97 audio
  ANDROID: overlayfs: override_creds=off option bypass creator_cred
  ANDROID: cuttlefish: enable CONFIG_NETFILTER_XT_TARGET_CT=y
  Revert "ANDROID: arm: process: Add display of memory around registers when displaying regs."
  Revert "ANDROID: overlayfs: override_creds=off option bypass creator_cred"
  ANDROID: overlayfs: override_creds=off option bypass creator_cred
  FROMGIT: binder: create node flag to request sender's security context
  ANDROID: revert "net: ipv4: sysfs_net_ipv4: Add sysfs-based knobs for controlling TCP window size"
  ANDROID: cpufreq: times: optimize proc files
  ANDROID: sched/walt: Fix the potential bad unlock issue
  ANDROID: sched/fair: Don't double account RT util in boosted_cpu_util()
  ANDROID: cpufreq: times: record fast switch frequency transitions
  ANDROID: DEBUG: fix build error when Macro DEBUG_EENV_DECISIONS is defined
  ANDROID: cuttlefish: enable CONFIG_NET_SCH_NETEM=y
  ANDROID: sched/walt: Fix lockdep assert issue
  Add XFRM-I to cuttlefish defconfigs
  ANDROID: Move from clang r346389b to r349610.
  ANDROID: Turn xt_owner module on
  ANDROID: Remove xt_qtaguid module from new kernels.
  UPSTREAM: virt_wifi: fix error return code in virt_wifi_newlink()
  ANDROID: arm64: lse: fix LSE atomics with LTO
  UPSTREAM: net: dev_is_mac_header_xmit() true for ARPHRD_RAWIP
  UPSTREAM: binder: filter out nodes when showing binder procs
  UPSTREAM: xfrm: Make set-mark default behavior backward compatible
  ANDROID: cuttlefish_defconfig: Enable CONFIG_RTC_HCTOSYS
  ANDROID: sched/rt: fix the problem that rt_rq's util is always zero.
  ANDROID: sched: Fix share_cap_level detect
  ANDROID: cfi: fix shadow rebasing
  UPSTREAM: dm: do not allow readahead to limit IO size
  UPSTREAM: ppp: Move PFC decompression to PPP generic layer
  UPSTREAM: l2tp: Add protocol field decompression
  BACKPORT: l2tp: remove ->recv_payload_hook
  UPSTREAM: zram: idle writeback fixes and cleanup
  UPSTREAM: zram: writeback throttle
  UPSTREAM: zram: add bd_stat statistics
  UPSTREAM: zram: support idle/huge page writeback
  UPSTREAM: zram: introduce ZRAM_IDLE flag
  UPSTREAM: zram: refactor flags and writeback stuff
  UPSTREAM: zram: fix lockdep warning of free block handling
  ANDROID: cuttlefish_defconfig: Enable vsock options
  ANDROID: mnt: Propagate remount correctly
  UPSTREAM: loop: drop caches if offset or block_size are changed
  UPSTREAM: crypto: adiantum - initialize crypto_spawn::inst
  UPSTREAM: crypto: adiantum - fix leaking reference to hash algorithm
  UPSTREAM: crypto: adiantum - adjust some comments to match latest paper
  UPSTREAM: crypto: adiantum - propagate CRYPTO_ALG_ASYNC flag to instance
  ANDROID: cuttlefish: enable CONFIG_NET_CLS_BPF=y
  Makefile: Fix 4.14.93 resolution
  ANDROID: cuttlefish_defconfig: remove DM_VERITY_HASH_PREFETCH_MIN_SIZE
  Revert "ANDROID: dm: verity: add minimum prefetch size"
  ANDROID: f2fs: Complement "android_fs" tracepoint of read path

Conflicts:
	Documentation/ABI/testing/sysfs-block-zram
	Documentation/blockdev/zram.txt
	Makefile
	drivers/block/zram/zram_drv.c
	drivers/block/zram/zram_drv.h
	drivers/md/Kconfig
	include/uapi/linux/android/binder.h
	kernel/sched/core.c
	kernel/sched/cpufreq_schedutil.c
	kernel/sched/fair.c
	net/l2tp/l2tp_ppp.c
	net/netfilter/xt_qtaguid.c

Change-Id: Ie4e343210602d26c0319138deb71ff0788e90a87
Signed-off-by: default avatarBlagovest Kolenichev <bkolenichev@codeaurora.org>
parents d8c860d9 5564e263
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -108,3 +108,42 @@ Description:
		managed by reference count and will not be stored in memory
		twice. Benefit of this feature largely depends on the workload
		so keep attention when use.

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.
+106 −22
Original line number Diff line number Diff line
@@ -164,12 +164,16 @@ 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
use_dedup		RW	show and set deduplication feature
idle		  	WO	mark allocated slot as idle

User space is advised to use the following files to read the device statistics.

@@ -222,6 +226,17 @@ line of text and contains the following stats separated by whitespace:
 meta_data_size	  the amount of metadata allocated for deduplication feature
 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
@@ -239,11 +254,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

@@ -253,16 +336,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
+23 −0
Original line number Diff line number Diff line
@@ -89,6 +89,29 @@ Only the lists of names from directories are merged. Other content
such as metadata and extended attributes are reported for the upper
directory only.  These attributes of the lower directory are hidden.

credentials
-----------

By default, all access to the upper, lower and work directories is the
recorded mounter's MAC and DAC credentials.  The incoming accesses are
checked against the caller's credentials.

In the case where caller MAC or DAC credentials do not overlap, a
use case available in older versions of the driver, the
override_creds mount flag can be turned off and help when the use
pattern has caller with legitimate credentials where the mounter
does not.  Several unintended side effects will occur though.  The
caller without certain key capabilities or lower privilege will not
always be able to delete files or directories, create nodes, or
search some restricted directories.  The ability to search and read
a directory entry is spotty as a result of the cache mechanism not
retesting the credentials because of the assumption, a privileged
caller can fill cache, then a lower privilege can read the directory
cache.  The uneven security model where cache, upperdir and workdir
are opened at privilege, but accessed without creating a form of
privilege escalation, should only be used with strict understanding
of the side effects and of the security policies.

whiteouts and opaque directories
--------------------------------

+3 −0
Original line number Diff line number Diff line
@@ -491,6 +491,9 @@ ifeq ($(cc-name),clang)
ifneq ($(CROSS_COMPILE),)
CLANG_TRIPLE	?= $(CROSS_COMPILE)
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_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)
GCC_TOOLCHAIN	:= $(realpath $(GCC_TOOLCHAIN_DIR)/..)
+1 −1
Original line number Diff line number Diff line
@@ -103,9 +103,9 @@ CONFIG_NETFILTER_XT_MATCH_LENGTH=y
CONFIG_NETFILTER_XT_MATCH_LIMIT=y
CONFIG_NETFILTER_XT_MATCH_MAC=y
CONFIG_NETFILTER_XT_MATCH_MARK=y
CONFIG_NETFILTER_XT_MATCH_OWNER=y
CONFIG_NETFILTER_XT_MATCH_POLICY=y
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
CONFIG_NETFILTER_XT_MATCH_QUOTA=y
CONFIG_NETFILTER_XT_MATCH_QUOTA2=y
CONFIG_NETFILTER_XT_MATCH_SOCKET=y
Loading