Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lineage-18.1] Update #27

Merged
merged 157 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
c339534
audit: fix error handling in audit_data_to_entry()
pcmoore Feb 23, 2020
aa45a60
msm: kgsl: Deregister gpu address on memdesc_sg_virt failure
Jan 7, 2021
4fb9383
net: ipv6: Use passed in table for nexthop lookups
Apr 25, 2016
695d0dc
msm: kgsl: Change start variable type to int in kgsl_iommu_add_global
Feb 11, 2021
34692c6
Merge "msm: kgsl: Change start variable type to int in kgsl_iommu_add…
Feb 23, 2021
66b4b5d
Merge "audit: fix error handling in audit_data_to_entry()"
Feb 25, 2021
3571713
fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info()
ramosian-glider May 28, 2020
2b8fab4
ANDROID: xt_qtaguid: Remove tag_entry from process list on untag
Jan 11, 2021
87bc4dd
msm: kgsl: Disable all yield packets for secure contexts
Jul 7, 2020
0aba83d
Merge "ANDROID: xt_qtaguid: Remove tag_entry from process list on untag"
Mar 9, 2021
1d16e8b
Merge "msm: kgsl: Disable all yield packets for secure contexts"
Mar 9, 2021
46d6505
dm verity: skip verity work on I/O errors when system is shutting down
hyeongseok-kim901 Dec 8, 2020
4197511
msm: kgsl: Access map_count only if entry is successfully allocated
Mar 16, 2021
9278e31
Merge "dm verity: skip verity work on I/O errors when system is shutt…
Mar 18, 2021
3735cd5
qseecom: Added boundary checks between two subsequent fields
Dec 15, 2020
8d7dacb
Merge "msm: kgsl: Deregister gpu address on memdesc_sg_virt failure"
Mar 22, 2021
4bf3c1b
Merge "qseecom: Added boundary checks between two subsequent fields"
Mar 22, 2021
7141cb6
Merge 4bf3c1bdf763900865c62e226a869aea5cc87123 on remote branch
Mar 26, 2021
9b4ab2e
net: fec: ptp: avoid register access when ipg clock is disabled
hthiery Feb 25, 2021
0bd585e
powerpc/4xx: Fix build errors from mfdcr()
mpe Feb 18, 2021
a7c25ce
atm: eni: dont release is never initialized
lzto Feb 27, 2021
6aeec3b
atm: lanai: dont run lanai_dev_close if not open
lzto Feb 28, 2021
9e29602
net: tehuti: fix error return code in bdx_probe()
XidianGeneral Mar 5, 2021
776a136
sun/niu: fix wrong RXMAC_BC_FRM_CNT_COUNT count
evdenis Mar 5, 2021
1f02de2
nfs: fix PNFS_FLEXFILE_LAYOUT Kconfig default
BtbN Feb 23, 2021
231fa32
NFS: Correct size calculation for create reply length
fsorenson Mar 8, 2021
59fa1b6
atm: uPD98402: fix incorrect allocation
lzto Mar 8, 2021
0a749fd
atm: idt77252: fix null-ptr-dereference
lzto Mar 8, 2021
38a3fce
u64_stats,lockdep: Fix u64_stats_init() vs lockdep
Mar 8, 2021
2bb5ec7
nfs: we don't support removing system.nfs4_acl
Jan 28, 2021
ed34d05
ia64: fix ia64_syscall_get_set_arguments() for break-based syscalls
Mar 13, 2021
5754655
ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign
Mar 13, 2021
65dd3a8
x86/tlb: Flush global mappings when KAISER is disabled
suryasaimadhu Mar 25, 2021
7d4eb66
squashfs: fix inode lookup sanity checks
sknsean Mar 25, 2021
329632f
squashfs: fix xattr id and id lookup sanity checks
plougher Mar 25, 2021
1dcf463
bus: omap_l3_noc: mark l3 irqs as IRQF_NO_THREAD
grygoriyS Jan 28, 2021
065039c
macvlan: macvlan_count_rx() needs to be aware of preemption
Mar 10, 2021
812675a
net: dsa: bcm_sf2: Qualify phydev->dev_flags based on port
ffainelli Mar 10, 2021
9251e3f
e1000e: add rtnl_lock() to e1000_reset_task
vlifshts Oct 21, 2020
0bb3f78
e1000e: Fix error handling in e1000_set_d0_lplu_state_82571
dinghaoliu Feb 28, 2021
055f876
net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template
Yunlongs Mar 11, 2021
b1ed9ae
can: c_can_pci: c_can_pci_remove(): fix use-after-free
lzto Mar 1, 2021
2e6831c
can: c_can: move runtime PM enable/disable to c_can_platform
lzto Mar 2, 2021
8f91d42
can: m_can: m_can_do_rx_poll(): fix extraneous msg loss warning
Mar 3, 2021
214a858
mac80211: fix rate mask reset
jmberg-intel Feb 12, 2021
4531282
net: cdc-phonet: fix data-interface release on probe failure
jhovold Mar 18, 2021
929aa64
RDMA/cxgb4: Fix adapter LE hash errors while destroying ipv6 listenin…
bharatpotnuri Mar 24, 2021
3deb834
perf auxtrace: Fix auxtrace queue conflict
ahunter6 Mar 8, 2021
4c4af81
can: dev: Move device back to init netns on owning netns delete
martinwilli Mar 2, 2021
47914f6
net: sched: validate stab values
Mar 10, 2021
915c5a9
mac80211: fix double free in ibss_leave
thillux Feb 13, 2021
47b6b27
xen-blkback: don't leak persistent grants from xen_blkbk_map()
jbeulich Mar 26, 2021
9b39031
Linux 4.4.264
gregkh Mar 30, 2021
e59fd12
msm: mdss: hdmi: finetune CEC_REFTIMER:REFTIMER
Mar 19, 2021
75b8318
Merge Linux 4.4.264 kernel
derfelot Apr 6, 2021
1b55900
selinux: vsock: Set SID for socket returned by accept()
Mar 29, 2021
e20bdf9
ipv6: weaken the v4mapped source check
kuba-moo Mar 17, 2021
ef04193
ext4: fix bh ref count on error paths
zhangzl2013 Mar 2, 2021
9e0b588
rpc: fix NULL dereference on kmalloc failure
Mar 2, 2021
ae00d6a
ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor …
jwrdegoede Feb 26, 2021
9e0c1df
ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor …
jwrdegoede Feb 26, 2021
97fe6eb
ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on…
benjaminjrood Feb 19, 2021
9ccfca0
scsi: st: Fix a use after free in st_open()
Yunlongs Mar 11, 2021
862caeb
scsi: qla2xxx: Fix broken #endif placement
Mar 14, 2021
8cade52
staging: comedi: cb_pcidas: fix request_irq() warn
lzto Mar 15, 2021
ce3a119
staging: comedi: cb_pcidas64: fix request_irq() warn
lzto Mar 15, 2021
2fc8ce5
ext4: do not iput inode under running transaction in ext4_rename()
zhangyi089 Mar 3, 2021
5d44e60
appletalk: Fix skb allocation size in loopback case
dougg3 Feb 12, 2021
9fcfaaf
net: wan/lmc: unregister device when no matching device is found
lzto Feb 15, 2021
37e8402
ALSA: usb-audio: Apply sample rate quirk to Logitech Connect
ikjn-cros Mar 24, 2021
1e1aa60
ALSA: hda/realtek: call alc_update_headset_mode() in hp_automute_hook
jason77-wang Mar 20, 2021
229371c
tracing: Fix stack trace event size
rostedt Apr 1, 2021
c7f0021
mm: fix race by making init_zero_pfn() early_initcall
lipnitsk Mar 30, 2021
9b5869d
reiserfs: update reiserfs_xattrs_initialized() condition
Mar 21, 2021
7e9ed17
pinctrl: rockchip: fix restore error in resume
Feb 23, 2021
7283a33
extcon: Fix error handling in extcon_dev_register
dinghaoliu Jan 19, 2021
63d8737
firewire: nosy: Fix a use-after-free bug in nosy_ioctl()
ZheyuMa Apr 3, 2021
7c5ac98
USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem
vpalatin Mar 19, 2021
6a51b1e
cdc-acm: fix BREAK rx code path adding necessary calls
oneukum Mar 11, 2021
8e422c1
USB: cdc-acm: downgrade message to debug
oneukum Mar 11, 2021
1f39a43
USB: cdc-acm: fix use-after-free after probe failure
jhovold Mar 22, 2021
1b404b9
staging: rtl8192e: Fix incorrect source in memcpy()
atul-g Mar 23, 2021
42521bf
staging: rtl8192e: Change state information from u16 to u8
atul-g Mar 23, 2021
a0c6468
Linux 4.4.265
gregkh Apr 7, 2021
48e2623
net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
PavelAndrianov Mar 10, 2021
2ae7953
mISDN: fix crash in fritzpci
lzto Mar 11, 2021
aa86e24
mac80211: choose first enabled channel for monitor
Mar 11, 2021
db4394a
x86/build: Turn off -fcf-protection for realmode targets
arndb Mar 23, 2021
0fad0c7
ia64: mca: allocate early mca with GFP_ATOMIC
Mar 25, 2021
41466e5
cifs: revalidate mapping when we open files for SMB1 POSIX
Mar 25, 2021
d2eb295
cifs: Silently ignore unknown oplock break handle
vwax Mar 19, 2021
ca97582
bpf, x86: Validate computation of branch displacements for x86-64
piotr-krysiuk Apr 5, 2021
5b6d574
ALSA: hda/realtek - Fix pincfg for Dell XPS 13 9370
fourdollars Aug 14, 2017
45b24c9
mtd: rawnand: tmio: Fix the probe error path
miquelraynal May 19, 2020
0e668e0
mtd: rawnand: socrates: Fix the probe error path
miquelraynal May 19, 2020
027e646
mtd: rawnand: sharpsl: Fix the probe error path
miquelraynal May 19, 2020
888a397
mtd: rawnand: plat_nand: Fix the probe error path
miquelraynal May 19, 2020
544ad9c
mtd: rawnand: pasemi: Fix the probe error path
miquelraynal May 19, 2020
80fd335
mtd: rawnand: orion: Fix the probe error path
miquelraynal May 19, 2020
ff6e7a8
mtd: rawnand: diskonchip: Fix the probe error path
miquelraynal May 19, 2020
e22b68f
tracing: Add a vmalloc_sync_mappings() for safe measure
rostedt May 6, 2020
b017d5b
init/Kconfig: make COMPILE_TEST depend on !UML
richardweinberger Aug 2, 2016
7341a93
init/Kconfig: make COMPILE_TEST depend on !S390
hcahca Nov 18, 2020
485ff03
init/Kconfig: make COMPILE_TEST depend on HAS_IOMEM
masahir0y Mar 13, 2021
caf172d
can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate
spectrum70 Mar 15, 2021
23a86a9
Linux 4.4.266
gregkh Apr 10, 2021
000abc8
Merge CAF tag LA.UM.8.4.1.r1-03100-8x98.0
derfelot Apr 12, 2021
27f794a
Merge Linux 4.4.265 kernel
derfelot Apr 12, 2021
f5c7607
Merge Linux 4.4.266 kernel
derfelot Apr 12, 2021
b8f44f5
yoshino: defconfig: Regenerate defonfigs
derfelot Apr 12, 2021
dd127b1
Revert "zram: Undo recent caf changes to be in line with Sony kernel"
derfelot Apr 14, 2021
038b12a
Revert "mm: Add z3fold special purpose allocator from Sony kernel"
derfelot Apr 14, 2021
0de802b
Revert "sdcardfs: Add Sony modifications"
derfelot Apr 14, 2021
4b78ed0
yoshino: defconfig: Disable z3fold zram allocator
derfelot Apr 14, 2021
797048d
yoshino: defconfig: Update defconfig for zram update and enable lz4
derfelot Apr 15, 2021
4198d16
iio: hid-sensor-prox: Fix scale not correct issue
yeapa Jan 30, 2021
5f59ece
ALSA: aloop: Fix initialization of controls
Apr 7, 2021
a1cdd18
nfc: fix refcount leak in llcp_sock_bind()
nixiaoming Mar 25, 2021
a524eab
nfc: fix refcount leak in llcp_sock_connect()
nixiaoming Mar 25, 2021
7ed6c0c
nfc: fix memory leak in llcp_sock_connect()
nixiaoming Mar 25, 2021
7f6c9e4
nfc: Avoid endless loops caused by repeated llcp_sock_connect()
nixiaoming Mar 25, 2021
77de34b
xen/evtchn: Change irq_info lock to raw_spinlock_t
luca-fancellu Apr 6, 2021
cfb476f
net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh
musamaanjum Apr 8, 2021
0583a65
ia64: fix user_stack_pointer() for ptrace()
Apr 9, 2021
afdbe8e
fs: direct-io: fix missing sdio->boundary
Apr 9, 2021
a8ea52f
parisc: parisc-agp requires SBA IOMMU driver
hdeller Apr 6, 2021
47dd44d
batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field
Apr 5, 2021
5acda2b
net: sched: sch_teql: fix null-pointer dereference
Snorch Apr 8, 2021
8cda9a0
sch_red: fix off-by-one checks in red_check_params()
Mar 25, 2021
054e853
gianfar: Handle error code at MAC address change
claudiu-m Mar 29, 2021
c8728e4
net:tipc: Fix a double free in tipc_sk_mcast_rcv
Yunlongs Mar 28, 2021
784758d
clk: fix invalid usage of list cursor in unregister
semihalf-bartosik-lukasz Apr 1, 2021
7a1197b
workqueue: Move the position of debug_work_activate() in __queue_work()
Zqiang1211 Feb 18, 2021
6860345
s390/cpcmd: fix inline assembly register clobbering
Mar 29, 2021
4a4956f
RDMA/cxgb4: check for ipv6 address properly while destroying listener
bharatpotnuri Mar 31, 2021
c9a4179
clk: socfpga: fix iomem pointer cast on 64-bit
krzk Mar 14, 2021
508e8b0
cfg80211: remove WARN_ON() in cfg80211_sme_connect
Apr 7, 2021
91ed28d
net: tun: set tun->dev->addr_len during TUNSETLINK processing
PhilPotter Apr 6, 2021
4c47184
drivers: net: fix memory leak in atusb_probe
pskrgag Apr 1, 2021
256c8ec
drivers: net: fix memory leak in peak_usb_create_dev
pskrgag Apr 1, 2021
cd19d85
net: mac802154: Fix general protection fault
pskrgag Mar 4, 2021
61293a1
net: ieee802154: nl-mac: fix check on panid
Feb 28, 2021
900ee67
net: ieee802154: fix nl802154 del llsec key
Feb 21, 2021
a698d26
net: ieee802154: fix nl802154 del llsec dev
Feb 21, 2021
68bc8ab
net: ieee802154: fix nl802154 add llsec key
Feb 21, 2021
2b5379d
net: ieee802154: fix nl802154 del llsec devkey
Feb 21, 2021
f4ec1cd
net: ieee802154: forbid monitor for set llsec params
Apr 5, 2021
034cfe1
net: ieee802154: forbid monitor for del llsec seclevel
Apr 5, 2021
b4f38a2
net: ieee802154: stop dump llsec params for monitors
Apr 5, 2021
369eced
drm/imx: imx-ldb: fix out of bounds array access warning
arndb Mar 24, 2021
b0d98b2
netfilter: x_tables: fix compat match/target pad out-of-bound write
Apr 7, 2021
b3ad500
perf map: Tighten snprintf() string precision to pass gcc check on so…
acmel Mar 5, 2021
b6bf35a
xen/events: fix setting irq affinity
jgross1 Apr 12, 2021
6a75b67
Linux 4.4.267
gregkh Apr 16, 2021
e62b4ec
Merge Linux 4.4.267 kernel
derfelot Apr 16, 2021
dfa214a
qcacmn: Fix Integer Overflow Leading to Buffer Overflow
Apr 4, 2018
12d5b3f
qcacld-3.0: Send assoc reject upon failing to post ASSOC_IND
Feb 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 25 additions & 93 deletions Documentation/ABI/testing/sysfs-block-zram
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,6 @@ Description:
device. The reset operation frees all the memory associated
with this device.

What: /sys/block/zram<id>/num_reads
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The num_reads file is read-only and specifies the number of
reads (failed or successful) done on this device.

What: /sys/block/zram<id>/num_writes
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The num_writes file is read-only and specifies the number of
writes (failed or successful) done on this device.

What: /sys/block/zram<id>/invalid_io
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The invalid_io file is read-only and specifies the number of
non-page-size-aligned I/O requests issued to this device.

What: /sys/block/zram<id>/failed_reads
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The failed_reads file is read-only and specifies the number of
failed reads happened on this device.

What: /sys/block/zram<id>/failed_writes
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The failed_writes file is read-only and specifies the number of
failed writes happened on this device.

What: /sys/block/zram<id>/max_comp_streams
Date: February 2014
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Expand All @@ -73,74 +38,24 @@ Description:
available and selected compression algorithms, change
compression algorithm selection.

What: /sys/block/zram<id>/notify_free
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The notify_free file is read-only. Depending on device usage
scenario it may account a) the number of pages freed because
of swap slot free notifications or b) the number of pages freed
because of REQ_DISCARD requests sent by bio. The former ones
are sent to a swap block device when a swap slot is freed, which
implies that this disk is being used as a swap disk. The latter
ones are sent by filesystem mounted with discard option,
whenever some data blocks are getting discarded.

What: /sys/block/zram<id>/zero_pages
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The zero_pages file is read-only and specifies number of zero
filled pages written to this disk. No memory is allocated for
such pages.

What: /sys/block/zram<id>/orig_data_size
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The orig_data_size file is read-only and specifies uncompressed
size of data stored in this disk. This excludes zero-filled
pages (zero_pages) since no memory is allocated for them.
Unit: bytes

What: /sys/block/zram<id>/compr_data_size
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The compr_data_size file is read-only and specifies compressed
size of data stored in this disk. So, compression ratio can be
calculated using orig_data_size and this statistic.
Unit: bytes

What: /sys/block/zram<id>/mem_used_total
Date: August 2010
Contact: Nitin Gupta <ngupta@vflare.org>
Description:
The mem_used_total file is read-only and specifies the amount
of memory, including allocator fragmentation and metadata
overhead, allocated for this disk. So, allocator space
efficiency can be calculated using compr_data_size and this
statistic.
Unit: bytes

What: /sys/block/zram<id>/mem_used_max
Date: August 2014
Contact: Minchan Kim <minchan@kernel.org>
Description:
The mem_used_max file is read/write and specifies the amount
of maximum memory zram have consumed to store compressed data.
For resetting the value, you should write "0". Otherwise,
you could see -EINVAL.
The mem_used_max file is write-only and is used to reset
the counter of maximum memory zram have consumed to store
compressed data. For resetting the value, you should write
"0". Otherwise, you could see -EINVAL.
Unit: bytes

What: /sys/block/zram<id>/mem_limit
Date: August 2014
Contact: Minchan Kim <minchan@kernel.org>
Description:
The mem_limit file is read/write and specifies the maximum
amount of memory ZRAM can use to store the compressed data. The
limit could be changed in run time and "0" means disable the
limit. No limit is the initial state. Unit: bytes
The mem_limit file is write-only and specifies the maximum
amount of memory ZRAM can use to store the compressed data.
The limit could be changed in run time and "0" means disable
the limit. No limit is the initial state. Unit: bytes

What: /sys/block/zram<id>/compact
Date: August 2015
Expand All @@ -166,3 +81,20 @@ Description:
The mm_stat file is read-only and represents device's mm
statistics (orig_data_size, compr_data_size, etc.) in a format
similar to block layer statistics file format.

What: /sys/block/zram<id>/debug_stat
Date: July 2016
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Description:
The debug_stat file is read-only and represents various
device's debugging info useful for kernel developers. Its
format is not documented intentionally and may change
anytime without any notice.

What: /sys/block/zram<id>/backing_dev
Date: June 2017
Contact: Minchan Kim <minchan@kernel.org>
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.
189 changes: 113 additions & 76 deletions Documentation/blockdev/zram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,62 +59,72 @@ num_devices parameter is optional and tells zram how many devices should be
pre-created. Default: 1.

2) Set max number of compression streams
Regardless the value passed to this attribute, ZRAM will always
allocate multiple compression streams - one per online CPUs - thus
allowing several concurrent compression operations. The number of
allocated compression streams goes down when some of the CPUs
become offline. There is no single-compression-stream mode anymore,
unless you are running a UP system or has only 1 CPU online.

To find out how many streams are currently available:
Regardless the value passed to this attribute, ZRAM will always
allocate multiple compression streams - one per online CPUs - thus
allowing several concurrent compression operations. The number of
allocated compression streams goes down when some of the CPUs
become offline. There is no single-compression-stream mode anymore,
unless you are running a UP system or has only 1 CPU online.

To find out how many streams are currently available:
cat /sys/block/zram0/max_comp_streams

3) Select compression algorithm
Using comp_algorithm device attribute one can see available and
currently selected (shown in square brackets) compression algorithms,
change selected compression algorithm (once the device is initialised
there is no way to change compression algorithm).
Using comp_algorithm device attribute one can see available and
currently selected (shown in square brackets) compression algorithms,
change selected compression algorithm (once the device is initialised
there is no way to change compression algorithm).

Examples:
Examples:
#show supported compression algorithms
cat /sys/block/zram0/comp_algorithm
lzo [lz4]

#select lzo compression algorithm
echo lzo > /sys/block/zram0/comp_algorithm

For the time being, the `comp_algorithm' content does not necessarily
show every compression algorithm supported by the kernel. We keep this
list primarily to simplify device configuration and one can configure
a new device with a compression algorithm that is not listed in
`comp_algorithm'. The thing is that, internally, ZRAM uses Crypto API
and, if some of the algorithms were built as modules, it's impossible
to list all of them using, for instance, /proc/crypto or any other
method. This, however, has an advantage of permitting the usage of
custom crypto compression modules (implementing S/W or H/W compression).

4) Set Disksize
Set disk size by writing the value to sysfs node 'disksize'.
The value can be either in bytes or you can use mem suffixes.
Examples:
# Initialize /dev/zram0 with 50MB disksize
echo $((50*1024*1024)) > /sys/block/zram0/disksize
Set disk size by writing the value to sysfs node 'disksize'.
The value can be either in bytes or you can use mem suffixes.
Examples:
# Initialize /dev/zram0 with 50MB disksize
echo $((50*1024*1024)) > /sys/block/zram0/disksize

# Using mem suffixes
echo 256K > /sys/block/zram0/disksize
echo 512M > /sys/block/zram0/disksize
echo 1G > /sys/block/zram0/disksize
# Using mem suffixes
echo 256K > /sys/block/zram0/disksize
echo 512M > /sys/block/zram0/disksize
echo 1G > /sys/block/zram0/disksize

Note:
There is little point creating a zram of greater than twice the size of memory
since we expect a 2:1 compression ratio. Note that zram uses about 0.1% of the
size of the disk when not in use so a huge zram is wasteful.

5) Set memory limit: Optional
Set memory limit by writing the value to sysfs node 'mem_limit'.
The value can be either in bytes or you can use mem suffixes.
In addition, you could change the value in runtime.
Examples:
# limit /dev/zram0 with 50MB memory
echo $((50*1024*1024)) > /sys/block/zram0/mem_limit
Set memory limit by writing the value to sysfs node 'mem_limit'.
The value can be either in bytes or you can use mem suffixes.
In addition, you could change the value in runtime.
Examples:
# limit /dev/zram0 with 50MB memory
echo $((50*1024*1024)) > /sys/block/zram0/mem_limit

# Using mem suffixes
echo 256K > /sys/block/zram0/mem_limit
echo 512M > /sys/block/zram0/mem_limit
echo 1G > /sys/block/zram0/mem_limit
# Using mem suffixes
echo 256K > /sys/block/zram0/mem_limit
echo 512M > /sys/block/zram0/mem_limit
echo 1G > /sys/block/zram0/mem_limit

# To disable memory limit
echo 0 > /sys/block/zram0/mem_limit
# To disable memory limit
echo 0 > /sys/block/zram0/mem_limit

6) Activate:
mkswap /dev/zram0
Expand Down Expand Up @@ -151,41 +161,15 @@ Name access description
disksize RW show and set the device's disk size
initstate RO shows the initialization state of the device
reset WO trigger device reset
num_reads RO the number of reads
failed_reads RO the number of failed reads
num_write RO the number of writes
failed_writes RO the number of failed writes
invalid_io RO the number of non-page-size-aligned I/O requests
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
max_comp_streams RW the number of possible concurrent compress operations
comp_algorithm RW show and change the compression algorithm
notify_free RO the number of notifications to free pages (either
slot free notifications or REQ_DISCARD requests)
zero_pages RO the number of zero filled pages written to this disk
orig_data_size RO uncompressed size of data stored in this disk
compr_data_size RO compressed size of data stored in this disk
mem_used_total RO the amount of memory allocated for this disk
mem_used_max RW the maximum amount of memory zram have consumed to
store the data (to reset this counter to the actual
current value, write 1 to this attribute)
mem_limit RW the maximum amount of memory ZRAM can use to store
the compressed data
pages_compacted RO the number of pages freed during compaction
(available only via zram<id>/mm_stat node)
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

WARNING
=======
per-stat sysfs attributes are considered to be deprecated.
The basic strategy is:
-- the existing RW nodes will be downgraded to WO nodes (in linux 4.11)
-- deprecated RO sysfs nodes will eventually be removed (in linux 4.11)

The list of deprecated attributes can be found here:
Documentation/ABI/obsolete/sysfs-block-zram

Basically, every attribute that has its own read accessible sysfs node
(e.g. num_reads) *AND* is accessible via one of the stat files (zram<id>/stat
or zram<id>/io_stat or zram<id>/mm_stat) is considered to be deprecated.

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

Expand All @@ -200,22 +184,41 @@ The stat file represents device's I/O statistics not accounted by block
layer and, thus, not available in zram<id>/stat file. It consists of a
single line of text and contains the following stats separated by
whitespace:
failed_reads
failed_writes
invalid_io
notify_free
failed_reads the number of failed reads
failed_writes the number of failed writes
invalid_io the number of non-page-size-aligned I/O requests
notify_free Depending on device usage scenario it may account
a) the number of pages freed because of swap slot free
notifications or b) the number of pages freed because of
REQ_DISCARD requests sent by bio. The former ones are
sent to a swap block device when a swap slot is freed,
which implies that this disk is being used as a swap disk.
The latter ones are sent by filesystem mounted with
discard option, whenever some data blocks are getting
discarded.

File /sys/block/zram<id>/mm_stat

The stat file represents device's mm statistics. It consists of a single
line of text and contains the following stats separated by whitespace:
orig_data_size
compr_data_size
mem_used_total
mem_limit
mem_used_max
zero_pages
num_migrated
orig_data_size uncompressed size of data stored in this disk.
This excludes same-element-filled pages (same_pages) since
no memory is allocated for them.
Unit: bytes
compr_data_size compressed size of data stored in this disk
mem_used_total the amount of memory allocated for this disk. This
includes allocator fragmentation and metadata overhead,
allocated for this disk. So, allocator space efficiency
can be calculated using compr_data_size and this statistic.
Unit: bytes
mem_limit the maximum amount of memory ZRAM can use to store
the compressed data
mem_used_max the maximum amount of memory zram have consumed to
store the data
same_pages the number of same element filled pages written to this disk.
No memory is allocated for such pages.
pages_compacted the number of pages freed during compaction
huge_pages the number of incompressible pages

9) Deactivate:
swapoff /dev/zram0
Expand All @@ -230,5 +233,39 @@ line of text and contains the following stats separated by whitespace:
resets the disksize to zero. You must set the disksize again
before reusing the device.

* Optional Feature

= writeback

With incompressible pages, there is no memory saving with zram.
Instead, with CONFIG_ZRAM_WRITEBACK, zram can write 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.

= memory tracking

With CONFIG_ZRAM_MEMORY_TRACKING, user can know information of the
zram block. It could be useful to catch cold or incompressible
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

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)

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
storage. It's a debugging feature so anyone shouldn't rely on it to work
properly.

Nitin Gupta
ngupta@vflare.org
Loading