-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
add zram support #6499
base: master
Are you sure you want to change the base?
add zram support #6499
Conversation
@@ -0,0 +1,28 @@ | |||
# SPDX-License-Identifier: GPL-2.0-or-later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# SPDX-License-Identifier: GPL-2.0-or-later | |
# SPDX-License-Identifier: GPL-2.0 |
@@ -4,7 +4,7 @@ | |||
PKG_NAME="image" | |||
PKG_LICENSE="GPL" | |||
PKG_SITE="https://libreelec.tv" | |||
PKG_DEPENDS_TARGET="toolchain squashfs-tools:host dosfstools:host fakeroot:host kmod:host mtools:host populatefs:host libc gcc linux linux-drivers linux-firmware ${BOOTLOADER} busybox util-linux corefonts network misc-packages debug exfatprogs" | |||
PKG_DEPENDS_TARGET="toolchain squashfs-tools:host dosfstools:host fakeroot:host kmod:host mtools:host populatefs:host libc gcc linux linux-drivers linux-firmware ${BOOTLOADER} busybox util-linux corefonts network misc-packages debug exfatprogs zram-swap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add it to the system-tools addons instead of shipping it by default ?
I am not sure (I have no idea about zram) we want zram or not afaik @chewitt had some words about it. Otherwise pls add the needed configs for the other devices too. |
in general its is a good idea to have zram (swap) on all low RAM units like all pi. so i vote for adding it (at least) to all low RAM units. i am using zram on all kinds of embedded os like openwrt, pfsense, small alpine vps, ....) and it serves well. |
Coincidentally I have been researching zram support independently for another project and whilst there is surprisingly little in the way of case studies published what I have read appears to be unusually positive with no downsides. Given our userbase is almost universally low in RAM resources I vote we pull this. |
Signed-off-by: Lukas Rusak <[email protected]>
Signed-off-by: Lukas Rusak <[email protected]>
Signed-off-by: Lukas Rusak <[email protected]>
Signed-off-by: Lukas Rusak <[email protected]>
Signed-off-by: Lukas Rusak <[email protected]>
Great! This is a really nice addition, thanks!
Note that zramctl is not needed at all. Zram can be configured exclusively thorugh sysfs. Of course, the script needs to be changed accordingly.
I'd personally choose zstd as the default, as it provides the best speed/ratio tradeoff. If lz4 is to be the default, please also make zstd available for those who prefer it. |
also a very good zram wiki page can be found at arch linux. i also vote for a user chooseable compression algo and additionally zram size (50% of 1GB RAM [-> ~2GB compressable data with zstd -> 2,5GB usable RAM space in sum] is nice but up to 100% [and more is possible] depending on the platform you run on, see wiki article above). |
LibreELEC isn't a general purpose distribution so configuration will likely be limited. The purpose of support is to benefit all the projects as a whole. Yes zstd is possibly a better choice than lz4. |
On beefyx86 hardware maybe, but likely not on low-end ARM - lz4 has faster compression speed than zstd and if people want to use it for swap (for whatever reason) this matters |
That's probably why I chose lz4 in the first place. I would actually prefer to use systemd-zram-generator but it's built in rust so would add a bit of build time to the overall build as the rust toolchain is required. That may be needed in the near future anyways as other rust components are added. |
This add support for using zram in LibreELEC https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html
I decided to use the simple script here https://github.com/foundObjects/zram-swap
It only needs zramctrl from util-linux (added in this PR) and mkswap from busybox (already included).
The default algorithm is LZ4 as it's less cpu heavy.
Testing was limited and I don't have any benchmarks.
I added the
kernel_options
that are required and adjusted the Generic and RPi4 kernel configs.