android_kernel_oneplus_msm8998/Documentation
Minchan Kim a900f9a050 BACKPORT: zram: introduce zram memory tracking
zRam as swap is useful for small memory device.  However, swap means
those pages on zram are mostly cold pages due to VM's LRU algorithm.
Especially, once init data for application are touched for launching,
they tend to be not accessed any more and finally swapped out.  zRAM can
store such cold pages as compressed form but it's pointless to keep in
memory.  Better idea is app developers free them directly rather than
remaining them on heap.

This patch tell us last access time of each block of zram via "cat
/sys/kernel/debug/zram/zram0/block_state".

The output is as follows,
      300    75.033841 .wh
      301    63.806904 s..
      302    63.806919 ..h

First column is zram's block index and 3rh one represents symbol (s:
same page w: written page to backing store h: huge page) of the block
state.  Second column represents usec time unit of the block was last
accessed.  So above example means the 300th block is accessed at
75.033851 second and it was huge so it was written to the backing store.

Admin can leverage this information to catch cold|incompressible pages
of process with *pagemap* once part of heaps are swapped out.

I used the feature a few years ago to find memory hoggers in userspace
to notify them what memory they have wasted without touch for a long
time.  With it, they could reduce unnecessary memory space.  However, at
that time, I hacked up zram for the feature but now I need the feature
again so I decided it would be better to upstream rather than keeping it
alone.  I hope I submit the userspace tool to use the feature soon.

[akpm@linux-foundation.org: fix i386 printk warning]
[minchan@kernel.org: use ktime_get_boottime() instead of sched_clock()]
  Link: http://lkml.kernel.org/r/20180420063525.GA253739@rodete-desktop-imager.corp.google.com
[akpm@linux-foundation.org: documentation tweak]
[akpm@linux-foundation.org: fix i386 printk warning]
[minchan@kernel.org: fix compile warning]
  Link: http://lkml.kernel.org/r/20180508104849.GA8209@rodete-desktop-imager.corp.google.com
[rdunlap@infradead.org: fix printk formats]
  Link: http://lkml.kernel.org/r/3652ccb1-96ef-0b0b-05d1-f661d7733dcc@infradead.org
Link: http://lkml.kernel.org/r/20180416090946.63057-5-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit c0265342bff4fcaa2cdf13f4596244c18d4a7ae5)
Signed-off-by: Peter Kalauskas <peskal@google.com>
Bug: 112488418
Change-Id: I932447d33d1b6af78ae6463b494006c725e5e38c
2018-08-24 08:17:23 -07:00
..
ABI UPSTREAM: zram: add config and doc file for writeback feature 2018-08-24 08:17:23 -07:00
accounting
acpi mfd: core: redo ACPI matching of the children devices 2015-10-26 15:25:53 +01:00
aoe
arm ARM: dts: keystone: k2l: fix kernel crash when clk_ignore_unused is not in bootargs 2015-11-23 10:36:27 -08:00
arm64 This is the 4.4.70 stable release 2017-05-25 17:31:28 +02:00
auxdisplay
backlight
blackfin
block ANDROID: mmc: Add CONFIG_MMC_SIMULATE_MAX_SPEED 2016-03-31 21:02:57 +00:00
blockdev BACKPORT: zram: introduce zram memory tracking 2018-08-24 08:17:23 -07:00
bus-devices
cdrom
cgroups CHROMIUM: remove Android's cgroup generic permissions checks 2016-10-17 22:55:19 -07:00
cma
connector
console
cpu-freq cpufreq: interactive: allow arbitrary speed / delay mappings 2016-02-16 13:52:53 -08:00
cpuidle
cris
crypto KEYS: Merge the type-specific data with the payload data 2015-10-21 15:18:36 +01:00
development-process
device-mapper This is the 4.4.134 stable release 2018-05-30 13:25:24 +02:00
devicetree This is the 4.4.127 stable release 2018-04-08 16:07:37 +02:00
dmaengine
DocBook Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2015-11-10 09:33:06 -08:00
driver-model driver-core: platform: Provide helpers for multi-driver modules 2015-10-05 05:02:40 +01:00
dvb
early-userspace
EDID
extcon
fault-injection
fb
features BACKPORT: arm64: add support for ioremap() block mappings 2016-09-22 13:38:22 -07:00
filesystems Merge remote-tracking branch 'origin/upstream-f2fs-stable-linux-4.4.y' into android-4.4 2018-07-30 17:25:04 -07:00
firmware_class
fmc
fpga usage documentation for FPGA manager core 2015-10-07 18:07:20 +01:00
frv
gpio There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
hid
hwmon ARM: SoC driver updates for v4.4 2015-11-10 15:00:03 -08:00
i2c i2c: i801: add Intel Lewisburg device IDs 2015-11-20 16:22:21 +01:00
ia64
ide
infiniband IB/hfi1: add driver files 2015-08-28 22:59:36 -04:00
input Input: add userio module 2015-10-27 18:55:31 -07:00
ioctl tee: generic TEE subsystem 2017-12-02 06:53:27 +00:00
isdn
ja_JP
kbuild kbuild: document recursive dependency limitation / resolution 2015-10-08 15:36:16 +02:00
kdump
ko_KR
laptops
leds
locking Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-11-03 16:10:43 -08:00
m68k
memory-devices
metag
mic samples: move mic/mpssd example code from Documentation 2017-03-12 06:37:23 +01:00
mips
misc-devices Doc:misc-devices: Fix typo in Documentation/misc-devices 2015-09-18 10:04:24 -06:00
mmc mmc: core: Remove MMC_CLKGATE 2015-10-26 16:00:09 +01:00
mn10300
mtd
namespaces
netlabel
networking This is the 4.4.137 stable release 2018-06-13 16:36:26 +02:00
nfc
nios2
nvdimm libnvdimm: documentation clarifications 2015-11-12 09:55:23 -08:00
nvmem
parisc
PCI
pcmcia
phy
platform
power PCI / PM: Update runtime PM documentation for PCI devices 2015-09-25 02:48:44 +02:00
powerpc SCSI misc on 20150901 2015-09-02 12:22:54 -07:00
pps
prctl
pti
ptp testptp: Silence compiler warnings on ppc64 2015-09-29 21:16:56 -07:00
rapidio
RCU Merge branches 'doc.2015.10.06a', 'percpu-rwsem.2015.10.06a' and 'torture.2015.10.06a' into HEAD 2015-10-07 16:06:25 -07:00
s390
scheduler sched/tune: add detailed documentation 2016-05-10 16:53:24 +08:00
scsi scsi: fix race between simultaneous decrements of ->host_failed 2016-07-27 09:47:39 -07:00
security KEYS: Merge the type-specific data with the payload data 2015-10-21 15:18:36 +01:00
serial Fix OpenSSH pty regression on close 2016-06-01 12:15:52 -07:00
sh
sound ALSA: hda - Remove obsoleted documentation 2015-10-17 18:34:24 +02:00
spi ARM: pxa: Remove unused clock_enable field from struct pxa2xx_spi_master 2015-09-20 19:37:20 +02:00
sysctl This is the 4.4.76 stable release 2017-07-05 16:16:58 +02:00
target target: use per-attribute show and store methods 2015-10-13 22:17:49 -07:00
thermal thermal: power_allocator: relax the requirement of two passive trip points 2015-09-14 07:41:45 -07:00
timers
tpm
trace UPSTREAM: trace: Update documentation for mono, mono_raw and boot clock 2016-11-28 18:46:58 -08:00
usb usb: core: lpm: fix usb3_hardware_lpm sysfs node 2016-01-31 11:28:58 -08:00
vDSO
video4linux [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
virtual KVM: PPC: Book3S HV: Save/restore XER in checkpointed register state 2017-01-09 08:07:49 +01:00
vm mm: make compound_head() robust 2015-11-06 17:50:42 -08:00
w1 w1: masters: omap_hdq: add support for 1-wire mode 2015-10-05 04:47:09 +01:00
watchdog Documentation/watchdog: add timeout and ping rate control to watchdog-test.c 2015-09-09 21:33:36 +02:00
wimax
x86 x86/pti: Document fix wrong index 2018-01-23 19:50:17 +01:00
xtensa
zh_CN sysfs.txt: fix pre-kernfs sysfs_dirent reference 2015-09-13 14:38:50 -06:00
00-INDEX Documentation: tee subsystem and op-tee driver 2017-12-02 06:53:27 +00:00
adding-syscalls.txt
android.txt pstore: Update Documentation/android.txt 2016-02-16 13:54:10 -08:00
applying-patches.txt
assoc_array.txt
atomic_ops.txt locking/atomics, cmpxchg: Privatize the inclusion of asm/cmpxchg.h 2015-09-13 10:35:46 +02:00
bad_memory.txt
basic_profiling.txt
bcache.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
BUG-HUNTING
bus-virt-phys-mapping.txt
cachetlb.txt
Changes kbuild: verify that $DEPMOD is installed 2018-08-17 20:56:45 +02:00
circular-buffers.txt
clk.txt
coccinelle.txt
CodeOfConflict
CodingStyle
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
digsig.txt
DMA-API-HOWTO.txt Documentation: DMA API: Be more explicit that nents is always the same 2015-09-24 15:50:06 -06:00
DMA-API.txt dma: remove external references to dma_supported 2015-11-09 15:11:24 -08:00
DMA-attributes.txt
dma-buf-sharing.txt
DMA-ISA-LPC.txt
dontdiff Documentation: dontdiff: remove media from dontdiff 2015-11-11 10:08:07 -07:00
dynamic-debug-howto.txt
edac.txt Documentation/EDAC: Add reference documents section for amd64_edac 2015-09-29 13:42:41 +02:00
efi-stub.txt
eisa.txt
email-clients.txt A few more documentation patches that wandered in and have no reason to 2015-11-13 09:19:05 -08:00
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gdb-kernel-debugging.txt
highuid.txt
HOWTO docs: update HOWTO for 3.x -> 4.x versioning 2015-08-24 11:28:17 -06:00
hsi.txt
hw_random.txt hwrng: doc - Fix device node name reference /dev/hw_random => /dev/hwrng 2015-09-21 22:00:41 +08:00
hwspinlock.txt
init.txt
initrd.txt
Intel-IOMMU.txt x86/vt-d: Fix documentation of DRHD 2015-08-25 10:44:49 +02:00
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt ipmi watchdog : add panic_wdt_timeout parameter 2015-11-16 06:28:43 -06:00
IRQ-affinity.txt
IRQ-domain.txt irqdomain: Documentation updates 2015-10-13 19:01:25 +02:00
IRQ.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kasan.txt UPSTREAM: mm, kasan: SLAB support 2017-12-14 08:19:10 -08:00
kcov.txt BACKPORT: kernel: add kcov code coverage 2017-12-18 09:41:57 -08:00
kernel-doc-nano-HOWTO.txt
kernel-docs.txt kernel-docs.txt: update kernelnewbies reference 2015-10-11 15:36:43 -06:00
kernel-parameters.txt This is the 4.4.144 stable release 2018-07-31 20:18:19 +02:00
kernel-per-CPU-kthreads.txt
kmemcheck.txt
kmemleak.txt
kobject.txt
kprobes.txt
kref.txt
kselftest.txt Documentation: Update kselftest.txt 2015-09-24 15:51:53 -06:00
ldm.txt
local_ops.txt
lockup-watchdogs.txt kernel/watchdog.c: add sysctl knob hardlockup_panic 2015-11-05 19:34:48 -08:00
logo.gif
logo.txt
lzo.txt
magic-number.txt
mailbox.txt
Makefile samples: move mic/mpssd example code from Documentation 2017-03-12 06:37:23 +01:00
ManagementStyle
md-cluster.txt md-cluster: fix deadlock issue on message lock 2015-08-31 19:41:41 +02:00
md.txt
media-framework.txt
memory-barriers.txt atomic: remove all traces of READ_ONCE_CTRL() and atomic*_read_ctrl() 2015-11-03 17:22:17 -08:00
memory-hotplug.txt
men-chameleon-bus.txt
module-signing.txt Documentation/module-signing.txt: Note need for version info if reusing a key 2016-08-20 18:09:27 +02:00
mono.txt
nommu-mmap.txt
ntb.txt
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
phy.txt
pi-futex.txt
pinctrl.txt pinctrl: Flag strict is a field in struct pinmux_ops 2016-10-07 15:23:41 +02:00
pnp.txt
preempt-locking.txt
printk-formats.txt lib/vsprintf: Remove atomic-unsafe support for %pCr 2018-07-03 11:21:27 +02:00
pwm.txt
ramoops.txt FROMLIST: pstore-ram: add Device Tree bindings 2016-02-16 13:54:11 -08:00
rbtree.txt documentation: fix small typo in rbtree.txt 2015-09-13 14:38:50 -06:00
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rtc.txt
SAK.txt
SecurityBugs
serial-console.txt
sgi-ioc4.txt
SM501.txt
smsc_ece1099.txt
sparse.txt
spec_ctrl.txt Documentation/spec_ctrl: Do some minor cleanups 2018-07-25 10:18:28 +02:00
speculation.txt Documentation: Document array_index_nospec 2018-02-25 11:03:53 +01:00
stable_api_nonsense.txt
stable_kernel_rules.txt
static-keys.txt locking/static_keys: Fix up the static keys documentation 2015-09-15 07:12:06 +02:00
SubmitChecklist
SubmittingDrivers
SubmittingPatches A few more documentation patches that wandered in and have no reason to 2015-11-13 09:19:05 -08:00
svga.txt
sync.txt sync: add Documentation/sync.txt 2016-02-16 13:53:25 -08:00
sysfs-rules.txt
sysrq.txt mm, oom: do not panic for oom kills triggered from sysrq 2015-09-08 15:35:28 -07:00
tee.txt BACKPORT: tee.txt: standardize document format 2018-01-12 16:44:44 +00:00
this_cpu_ops.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt
VGA-softcursor.txt
vgaarbiter.txt
video-output.txt
vme_api.txt
volatile-considered-harmful.txt
workqueue.txt
xillybus.txt
xz.txt
zorro.txt