No description
Find a file
Chenyang Zhong 16ac982064
sdm710-common: rootdir: Switch to lz4 for zram
5.4 kernel defaults to lzo-rle for zram. lzo-rle added run-length
encoding for lzo, which is beneficial to the use case of zram that
often has long runs of zero bytes. However, according to my testing
results, lzo-rle still has lower decompression throughput and higher
access latency compared to lz4. lzo-rle beats lz4 in compression
ratio, but most Xiaomi SM8350 devices have either 8GB or 12GB of RAM
where memory pressure hardly happens. Therefore, lz4's higher throughput
and lower latency is more preferable.

Now that I added LZ4_FAST_DEC_LOOP to the kernel lz4 module from
upstream lz4 1.9.x release, the decompression speed has increased
by another 10%, which leads further ahead lzo-rle.

Test setup:
- Disable swap on zram if it is enabled
  $ swapoff /dev/block/zram0
- If you want to change the comp_algorithm after zram has been
  initialized, reset zram first.
  $ echo 1 > /sys/block/zram0/reset
- Set the comp_algorithm. For example, for lz4
  $ echo lz4 > /sys/block/zram0/comp_algorithm
- Set up zram size
  $ echo 4294967296 > /sys/block/zram0/disksize
- Make the swap
  $ mkswap /dev/block/zram0
- Pre-fill zram with 1GB of real-word zram data dumped previously under
  memory pressure. For example,
  $ dd if=/sdcard/zram.test of=/dev/block/zram0 bs=1m count=1000

Random 4k read:
$ fio --readonly --name=randread --direct=1 --rw=randread --ioengine=psync \
  --randrepeat=0 --numjobs=4 --iodepth=1 --group_reporting=1 \
  --filename=/dev/block/zram0 --bs=4K --size=1000M

lzo-rle: read: IOPS=1547k, BW=6042MiB/s (6336MB/s)(4000MiB/662msec)
lz4: read: IOPS=1646k, BW=6431MiB/s (6743MB/s)(4000MiB/622msec)
lz4 fast dec: read: IOPS=1775k, BW=6932MiB/s (7269MB/s)(4000MiB/577msec)

Sequencial 4k read:
$ fio --readonly --name=zram_seqread --direct=1 --rw=read --ioengine=psync \
  --numjobs=4 --iodepth=1 --group_reporting=1 --filename=/dev/block/zram0 \
  --bs=4K --size=1000M

lzo-rle: read: IOPS=1816k, BW=7092MiB/s (7437MB/s)(4000MiB/564msec)
lz4: read: IOPS=1907k, BW=7449MiB/s (7811MB/s)(4000MiB/537msec)
lz4 fast dec: read: IOPS=2004k, BW=7828MiB/s (8208MB/s)(4000MiB/511msec)

Compression ratio from /sys/block/zram0/mm_stat
lzo-rle: 1048576000 -> 81969152
lz4: 1048576000 -> 86200320

zstd was also considered. It offers really nice compression ratio,
1048576000 -> 59899904, but the throughput and latency are so much
worse than lz4 and lzo-rle. It is probably more suitable for traditional
desktop/server swap setup with less aggressive swappiness value. It can
also help alleviate high memory pressure situation by compressing the
RAM to smaller size.
2024-02-10 21:14:20 +02:00
audio sdm710-common: audio: Add new flag name to compress offload case 2023-06-26 22:51:37 +03:00
configs sdm710-common: Flash dummy super image if needed 2023-10-27 22:30:20 +03:00
keylayout sdm710-common: Add FP Gestures 2023-06-17 17:03:40 +03:00
libqti-perfd-client sdm710-common: libqti-perfd-client: Remove namespace declaration 2022-01-03 21:25:51 +01:00
light sdm710-common: Initial commonized tree 2021-07-25 21:56:17 +02:00
overlay sdm710-common: overlay: Make the UI smoother 2023-11-26 10:45:09 +02:00
overlay-pe/frameworks/base/core/res/res/values sdm710-common: overlay: Restore default config_proximityCheckTimeout 2023-06-28 19:42:50 +03:00
permissions sdm710-common: grant permissions for carrier settings 2023-06-26 00:20:01 +03:00
pocketmode sdm710-common: Add PocketMode app 2021-07-25 02:07:25 +02:00
power-libperfmgr sdm710-common: power-libperfmgr: move dt2w mode on top of setMode switch 2022-11-12 15:09:34 +01:00
rootdir sdm710-common: rootdir: Switch to lz4 for zram 2024-02-10 21:14:20 +02:00
rro_overlays sdm710-common: wifi: Configure correct overlay configuration. 2023-06-17 17:03:48 +03:00
seccomp sdm710-common: Drop unwanted codec2 seccomp policy 2021-08-16 21:55:24 +02:00
sepolicy Revert "sdm710-common: sepolicy: Add SELinux policy for flags_health_check" 2023-11-25 22:17:59 +02:00
wifi sdm710-common: wlan: Remove obselete gEnableBypass11d config 2024-02-10 21:11:22 +02:00
Android.bp kunlun2: Import Pixel power AIDL HAL 2021-01-01 17:52:11 +01:00
Android.mk sdm710-common: Move super_dummy build to Android.mk 2023-10-27 22:30:21 +03:00
aosp.dependencies sdm710-common: dependencies: track branch thirteen 2022-09-18 20:37:31 +02:00
BoardConfigCommon.mk sdm710-common: Inherit common partition reserved sizes 2024-02-10 20:52:44 +02:00
compatibility_matrix.xml sdm710-common: Uprev manifests/FCM level 2023-08-15 13:22:13 +03:00
config.fs config_fs: Remove wcnss_filter 2021-07-12 02:23:57 +02:00
extract-files.sh sdm710-common Unblock madvise syscall for dspservice 2023-06-17 17:03:48 +03:00
generate_sha1_from_commit.sh sdm710-common: update script to handle added and deleted blobs 2023-06-25 23:53:54 +03:00
LICENSE Create LICENSE 2021-03-22 09:45:31 +01:00
manifest.xml sdm710-common: Switch to full IWLAN mode 2023-11-02 11:21:05 +02:00
odm.prop Import stock vendor and odm properties 2021-07-12 02:23:58 +02:00
product.prop sdm710-common: sepolicy: fix vendor_init prop access denial 2023-11-25 20:34:25 +02:00
proprietary-files.txt sdm710-common: proprietary: Add missing vendor.qti.hardware.sensorscalibrate-V1.0-java.jar 2023-06-28 20:48:30 +03:00
releasetools.py sdm710-common: Flash dummy super image if needed 2023-10-27 22:30:20 +03:00
reorder-libs.py sdm710-common: Add a script to reorder blobs list 2023-06-17 17:03:58 +03:00
sdm710.mk sdm710-common: Remove libtinyxml 2024-02-10 21:00:10 +02:00
setup-makefiles.sh sdm710-common: Add support for kunlun2_row 2021-08-01 22:25:35 +02:00
system.prop sdm710-common: Add radio props to improve battery life 2023-11-26 10:39:02 +02:00
system_ext.prop Move DPM feature property to /system_ext 2021-07-16 18:44:06 +02:00
update-sha1sums.py sdm710-common: Add script to update sha1sums of kanged blobs 2023-06-17 17:03:59 +03:00
vendor.prop sdm710-common: Use FUSE passthrough by default 2024-02-10 21:01:30 +02:00