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

Commit 2f8eb1ca authored by jianzhou's avatar jianzhou
Browse files

Merge android-4.9.155 (32e6695e) into msm-4.9



* refs/heads/tmp-32e6695e:
  Linux 4.9.155
  fanotify: fix handling of events on child sub-directory
  fs: don't scan the inode cache before SB_BORN is set
  drivers: core: Remove glue dirs from sysfs earlier
  cifs: Always resolve hostname before reconnecting
  mm: migrate: don't rely on __PageMovable() of newpage after unlocking it
  mm: hwpoison: use do_send_sig_info() instead of force_sig()
  mm, oom: fix use-after-free in oom_kill_process
  kernel/exit.c: release ptraced tasks before zap_pid_ns_processes
  mmc: sdhci-iproc: handle mmc_of_parse() errors during probe
  platform/x86: asus-nb-wmi: Drop mapping of 0x33 and 0x34 scan codes
  platform/x86: asus-nb-wmi: Map 0x35 to KEY_SCREENLOCK
  gfs2: Revert "Fix loop in gfs2_rbm_find"
  arm64: hibernate: Clean the __hyp_text to PoC after resume
  arm64: hyp-stub: Forbid kprobing of the hyp-stub
  arm64: kaslr: ensure randomized quantities are clean also when kaslr is off
  ARM: cns3xxx: Fix writing to wrong PCI config registers after alignment
  fs/dcache: Fix incorrect nr_dentry_unused accounting in shrink_dcache_sb()
  CIFS: Do not count -ENODATA as failure for query directory
  ipvlan, l3mdev: fix broken l3s mode wrt local routes
  l2tp: fix reading optional fields of L2TPv3
  l2tp: remove l2specific_len dependency in l2tp_core
  net/mlx5e: Allow MAC invalidation while spoofchk is ON
  ucc_geth: Reset BQL queue when stopping device
  net/rose: fix NULL ax25_cb kernel panic
  netrom: switch to sock timer API
  net/mlx4_core: Add masking for a few queries on HCA caps
  l2tp: copy 4 more bytes to linear part if necessary
  ipv6: Consider sk_bound_dev_if when binding a socket to an address
  fs: add the fsnotify call to vfs_iter_write
  Fix "net: ipv4: do not handle duplicate fragments as overlapping"
  BACKPORT: 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: zram: fix incorrect assignment for access time
  UPSTREAM: zram: idle writeback fixes and cleanup
  UPSTREAM: zram: writeback throttle
  UPSTREAM: zram: add bd_stat statistics
  BACKPORT: zram: support idle/huge page writeback
  UPSTREAM: zram: introduce ZRAM_IDLE flag
  BACKPORT: zram: refactor flags and writeback stuff
  UPSTREAM: zram: fix double free backing device
  UPSTREAM: zram: fix lockdep warning of free block handling
  Linux 4.9.154
  btrfs: dev-replace: go back to suspended state if target device is missing
  btrfs: fix error handling in btrfs_dev_replace_start
  f2fs: read page index before freeing
  nvmet-rdma: fix null dereference under heavy load
  nvmet-rdma: Add unlikely for response allocated check
  s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU
  irqchip/gic-v3-its: Align PCI Multi-MSI allocation on their size
  perf unwind: Take pgoff into account when reporting elf to libdwfl
  perf unwind: Unwind with libdw doesn't take symfs into account
  vt: invoke notifier on screen size change
  can: bcm: check timer values before ktime conversion
  can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it
  x86/kaslr: Fix incorrect i8254 outb() parameters
  x86/selftests/pkeys: Fork() to check for state being preserved
  KVM: x86: Fix single-step debugging
  dm thin: fix passdown_double_checking_shared_status()
  acpi/nfit: Fix command-supported detection
  acpi/nfit: Block function zero DSMs
  Input: uinput - fix undefined behavior in uinput_validate_absinfo()
  compiler.h: enable builtin overflow checkers and add fallback code
  Input: xpad - add support for SteelSeries Stratus Duo
  CIFS: Fix possible hang during async MTU reads and writes
  tty/n_hdlc: fix __might_sleep warning
  uart: Fix crash in uart_write and uart_put_char
  tty: Handle problem if line discipline does not have receive_buf
  staging: rtl8188eu: Add device code for D-Link DWA-121 rev B1
  char/mwave: fix potential Spectre v1 vulnerability
  s390/smp: fix CPU hotplug deadlock with CPU rescan
  s390/early: improve machine detection
  ARC: perf: map generic branches to correct hardware condition
  ARCv2: lib: memeset: fix doing prefetchw outside of buffer
  ASoC: rt5514-spi: Fix potential NULL pointer dereference
  ASoC: atom: fix a missing check of snd_pcm_lib_malloc_pages
  USB: serial: pl2303: add new PID to support PL2303TB
  USB: serial: simple: add Motorola Tetra TPG2200 device id
  ipfrag: really prevent allocation on netns exit
  net_sched: refetch skb protocol for each filter
  net: ipv4: Fix memory leak in network namespace dismantle
  vhost: log dirty page correctly
  openvswitch: Avoid OOB read when parsing flow nlattrs
  net: Fix usage of pskb_trim_rcsum
  net: bridge: Fix ethernet header pointer before check skb forwardable
  Linux 4.9.153
  locking/qspinlock: Pull in asm/byteorder.h to ensure correct endianness
  ipmi:ssif: Fix handling of multi-part return messages
  mm, proc: be more verbose about unstable VMA flags in /proc/<pid>/smaps
  mm/page-writeback.c: don't break integrity writeback on ->writepage() error
  ocfs2: fix panic due to unrecovered local alloc
  scsi: megaraid: fix out-of-bound array accesses
  scsi: smartpqi: correct lun reset issues
  sysfs: Disable lockdep for driver bind/unbind files
  ALSA: bebob: fix model-id of unit for Apogee Ensemble
  dm snapshot: Fix excessive memory usage and workqueue stalls
  tools lib subcmd: Don't add the kernel sources to the include path
  dm kcopyd: Fix bug causing workqueue stalls
  perf parse-events: Fix unchecked usage of strncpy()
  perf svghelper: Fix unchecked usage of strncpy()
  perf intel-pt: Fix error with config term "pt=0"
  tty/serial: do not free trasnmit buffer page under port lock
  mmc: atmel-mci: do not assume idle after atmci_request_end
  kconfig: fix memory leak when EOF is encountered in quotation
  kconfig: fix file name and line number of warn_ignored_character()
  clk: imx6q: reset exclusive gates on init
  scsi: target: use consistent left-aligned ASCII INQUIRY data
  net: call sk_dst_reset when set SO_DONTROUTE
  media: firewire: Fix app_info parameter type in avc_ca{,_app}_info
  powerpc/pseries/cpuidle: Fix preempt warning
  powerpc/xmon: Fix invocation inside lock region
  pstore/ram: Do not treat empty buffers as valid
  jffs2: Fix use of uninitialized delayed_work, lockdep breakage
  rxe: IB_WR_REG_MR does not capture MR's iova field
  selinux: always allow mounting submounts
  arm64: perf: set suppress_bind_attrs flag to true
  MIPS: SiByte: Enable swiotlb for SWARM, LittleSur and BigSur
  ALSA: oxfw: add support for APOGEE duet FireWire
  serial: set suppress_bind_attrs flag only if builtin
  writeback: don't decrement wb->refcnt if !wb->bdi
  e1000e: allow non-monotonic SYSTIM readings
  platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey
  ipv6: Take rcu_read_lock in __inet6_bind for mapped addresses
  ipv6: Consider sk_bound_dev_if when binding a socket to a v4 mapped address
  r8169: Add support for new Realtek Ethernet
  ANDROID: cfi: fix shadow rebasing
  UPSTREAM: dm: do not allow readahead to limit IO size
  UPSTREAM: readahead: stricter check for bdi io_pages
  UPSTREAM: mm: don't cap request size based on read-ahead setting
  Revert "UPSTREAM: dm: do not allow readahead to limit IO size"
  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

Change-Id: Ied9b99c5d4cec558b44c3cb720257458d7e3f40e
Signed-off-by: default avatarjianzhou <jianzhou@codeaurora.org>
parents 902a0cea 32e6695e
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
+3 −1
Original line number Diff line number Diff line
@@ -488,7 +488,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.
+1 −1
Original line number Diff line number Diff line
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 152
SUBLEVEL = 155
EXTRAVERSION =
NAME = Roaring Lionus

+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ static const char * const arc_pmu_ev_hw_map[] = {

	/* counts condition */
	[PERF_COUNT_HW_INSTRUCTIONS] = "iall",
	[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmp", /* Excludes ZOL jumps */
	/* All jump instructions that are taken */
	[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmptak",
	[PERF_COUNT_ARC_BPOK]         = "bpok",	  /* NP-NT, PT-T, PNT-NT */
#ifdef CONFIG_ISA_ARCV2
	[PERF_COUNT_HW_BRANCH_MISSES] = "bpmp",
Loading