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

Commit a5dad64b authored by Ivaylo Georgiev's avatar Ivaylo Georgiev
Browse files

Merge android-4.19.17 (73dc755e) into msm-4.19



* refs/heads/tmp-73dc755e:
  Linux 4.19.17
  nbd: Use set_blocksize() to set device blocksize
  media: vb2: be sure to unlock mutex on errors
  selftests: Fix test errors related to lib.mk khdr target
  drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock
  loop: drop caches if offset or block_size are changed
  loop: Fix double mutex_unlock(&loop_ctl_mutex) in loop_control_ioctl()
  loop: Get rid of 'nested' acquisition of loop_ctl_mutex
  loop: Avoid circular locking dependency between loop_ctl_mutex and bd_mutex
  loop: Fix deadlock when calling blkdev_reread_part()
  loop: Move loop_reread_partitions() out of loop_ctl_mutex
  loop: Move special partition reread handling in loop_clr_fd()
  loop: Push loop_ctl_mutex down to loop_change_fd()
  loop: Push loop_ctl_mutex down to loop_set_fd()
  loop: Push loop_ctl_mutex down to loop_set_status()
  loop: Push loop_ctl_mutex down to loop_get_status()
  loop: Push loop_ctl_mutex down into loop_clr_fd()
  loop: Split setting of lo_state from loop_clr_fd
  loop: Push lo_ctl_mutex down into individual ioctls
  loop: Get rid of loop_index_mutex
  loop: Fold __loop_release into loop_release
  block/loop: Use global lock for ioctl() operation.
  block/loop: Don't grab "struct file" for vfs_getattr() operation.
  tipc: fix uninit-value in tipc_nl_compat_doit
  tipc: fix uninit-value in tipc_nl_compat_name_table_dump
  tipc: fix uninit-value in tipc_nl_compat_link_set
  tipc: fix uninit-value in tipc_nl_compat_bearer_enable
  tipc: fix uninit-value in tipc_nl_compat_link_reset_stats
  tipc: fix uninit-value in in tipc_conn_rcv_sub
  sctp: allocate sctp_sockaddr_entry with kzalloc
  blockdev: Fix livelocks on loop device
  selinux: fix GPF on invalid policy
  block: use rcu_work instead of call_rcu to avoid sleep in softirq
  netfilter: ebtables: account ebt_table_info to kmemcg
  sunrpc: handle ENOMEM in rpcb_getport_async
  media: vb2: vb2_mmap: move lock up
  LSM: Check for NULL cred-security on free
  ipv6: make icmp6_send() robust against null skb->dev
  bpf: in __bpf_redirect_no_mac pull mac only if present
  media: vivid: set min width/height to a value > 0
  media: vivid: fix error handling of kthread_run
  omap2fb: Fix stack memory disclosure
  fix int_sqrt64() for very large numbers
  Disable MSI also when pcie-octeon.pcie_disable on
  arm64: dts: marvell: armada-ap806: reserve PSCI area
  arm64: kaslr: ensure randomized quantities are clean to the PoC
  pstore/ram: Avoid allocation and leak of platform data
  net: dsa: realtek-smi: fix OF child-node lookup
  kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
  RDMA/vmw_pvrdma: Return the correct opcode when creating WR
  RDMA/nldev: Don't expose unsafe global rkey to regular user
  media: v4l: ioctl: Validate num_planes for debug messages
  mfd: tps6586x: Handle interrupts on suspend
  OF: properties: add missing of_node_put
  drm/i915/gvt: Fix mmap range check
  MIPS: lantiq: Fix IPI interrupt handling
  MIPS: BCM47XX: Setup struct device for the SoC
  mips: fix n32 compat_ipc_parse_version
  scsi: sd: Fix cache_type_store()
  scsi: core: Synchronize request queue PM status only on successful resume
  Yama: Check for pid death before checking ancestry
  btrfs: wait on ordered extents on abort cleanup
  Revert "btrfs: balance dirty metadata pages in btrfs_finish_ordered_io"
  xen: Fix x86 sched_clock() interface for xen
  crypto: talitos - fix ablkcipher for CONFIG_VMAP_STACK
  crypto: talitos - reorder code in talitos_edesc_alloc()
  crypto: authenc - fix parsing key with misaligned rta_len
  crypto: bcm - convert to use crypto_authenc_extractkeys()
  crypto: ccree - convert to use crypto_authenc_extractkeys()
  crypto: authencesn - Avoid twice completion call in decrypt path
  crypto: caam - fix zero-length buffer DMA mapping
  crypto: sm3 - fix undefined shift by >= width of value
  r8169: load Realtek PHY driver module before r8169
  ip: on queued skb use skb_header_pointer instead of pskb_may_pull
  bonding: update nest level on unlink
  r8169: don't try to read counters if chip is in a PCI power-save state
  smc: move unhash as early as possible in smc_release()
  lan743x: Remove phy_read from link status change function
  tun: publish tfile after it's fully initialized
  tcp: change txhash on SYN-data timeout
  packet: Do not leak dev refcounts on error exit
  net: bridge: fix a bug on using a neighbour cache entry without checking its state
  ipv6: fix kernel-infoleak in ipv6_local_error()
  arm64: Don't trap host pointer auth use to EL2
  arm64/kvm: consistently handle host HCR_EL2 flags
  scsi: target: iscsi: cxgbit: fix csk leak
  scsi: target: iscsi: cxgbit: fix csk leak
  Revert "scsi: target: iscsi: cxgbit: fix csk leak"
  mmc: sdhci-msm: Disable CDR function on TX
  netfilter: nf_conncount: fix argument order to find_next_bit
  netfilter: nf_conncount: speculative garbage collection on empty lists
  netfilter: nf_conncount: move all list iterations under spinlock
  netfilter: nf_conncount: merge lookup and add functions
  netfilter: nf_conncount: restart search when nodes have been erased
  netfilter: nf_conncount: split gc in two phases
  netfilter: nf_conncount: don't skip eviction when age is negative
  netfilter: nf_conncount: replace CONNCOUNT_LOCK_SLOTS with CONNCOUNT_SLOTS
  can: gw: ensure DLC boundaries after CAN frame modification
  tty: Don't hold ldisc lock in tty_reopen() if ldisc present
  tty: Simplify tty->count math in tty_reopen()
  tty: Hold tty_ldisc_lock() during tty_reopen()
  tty/ldsem: Wake up readers after timed out down_write()
  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

Conflicts:
	drivers/mmc/host/sdhci-msm.c
	drivers/scsi/scsi_pm.c

Change-Id: I536e9aa79ee729312fd91c29f703dd2b9b29bd2f
Signed-off-by: default avatarIvaylo Georgiev <irgeorgiev@codeaurora.org>
parents 27031678 73dc755e
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -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.
+105 −21
Original line number Diff line number Diff line
@@ -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.
@@ -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
@@ -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

@@ -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
+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 19
SUBLEVEL = 16
SUBLEVEL = 17
EXTRAVERSION =
NAME = "People's Front"

+17 −0
Original line number Diff line number Diff line
@@ -27,6 +27,23 @@
		method = "smc";
	};

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		/*
		 * This area matches the mapping done with a
		 * mainline U-Boot, and should be updated by the
		 * bootloader.
		 */

		psci-area@4000000 {
			reg = <0x0 0x4000000 0x0 0x200000>;
			no-map;
		};
	};

	ap806 {
		#address-cells = <2>;
		#size-cells = <2>;
+2 −0
Original line number Diff line number Diff line
@@ -182,6 +182,8 @@ CONFIG_NET_CLS_BPF=y
CONFIG_NET_EMATCH=y
CONFIG_NET_EMATCH_U32=y
CONFIG_NET_CLS_ACT=y
CONFIG_VSOCKETS=y
CONFIG_VIRTIO_VSOCKETS=y
CONFIG_CFG80211=y
# CONFIG_CFG80211_DEFAULT_PS is not set
# CONFIG_CFG80211_CRDA_SUPPORT is not set
Loading