RFE: enable zram support
Describe your issue
What's the expected behaviour?
I'm not sure what process there is to request additional kernel knobs ; more rationale at the end of the post.
main/linux-postmarketos-allwinner/config-postmarketos-allwinner.aarch64
would have CONFIG_ZRAM=m
What device are you using?
pine64-pinephone (2GB version)
On what postmarketOS version did you encounter the issue?
-
edge ( master
branch) -
stable ( v20.05
branch)
On what environment did you encounter the issue?
Phone environments
-
Phosh -
Plasma Mobile -
Sxmo
Other
-
No environment -
GNOME -
KDE Plasma -
Kodi -
MATE -
Shelli -
Sway -
Weston -
Xfce4 -
fbkeyboard -
i3wm
How did you get postmarketOS image?
-
from https://images.postmarketos.org -
I built it using pmbootstrap -
It was preinstalled on my device
Additional information
Some more rationale:
zram is a mechanism to make a block device backed by compressed ram.
A common usage pattern nowadays is swap on zram, which basically means that paged out memory will be compressed and still in ram.
It may look a bit weird but most memory are fairly compressible and this is still very good latency, so when used appropriately it allows e.g. in my case building memory hungry (c++) apps on devices with limited memory but in general it can be seen as just freeing a bit more memory for page cache or whatever you want to use it for.
alpine (in edge/community) has zram-init (and zram-init-openrc) packages that can help using zram; default use it as swap device and tries to mount extra devices to /tmp and /var/tmp but that's easy enough to tune in /etc/conf.d/zram-init
It's also pretty straightforward to use with zramctl (util-linux), e.g.:
# modprobe zram
# zramctl -f -a zstd -s 1G
/dev/zram0
# mkswap /dev/zram0
(priority helps if you have multiple swap devices)
# swapon -p 32767 /dev/zram0
# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 1G 4K 58B 4K 4 [SWAP]
(... after a while... Not very convincing I'll admit, would need to sample
during some memory hogging compilation or something... But at least the
compression ratio is very good!)
# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 1G 24.8M 5.7M 6.3M 4 [SWAP]
(FWIW, fedora IoT uses 50% of the device's ram as zram device size for swap enabled by default; folks seem happy with it)