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

[feature request] compile ram zswap, too. #2

Open
DrYak opened this issue Oct 6, 2023 · 1 comment
Open

[feature request] compile ram zswap, too. #2

DrYak opened this issue Oct 6, 2023 · 1 comment

Comments

@DrYak
Copy link

DrYak commented Oct 6, 2023

Speaking of activating stuff in the kernel, would if be possible to activate Zswap? It's a bit more recent than the Zram that 4.x kernels use in SailfishOS.

Ideally:

CONFIG_ZSWAP=y
# CONFIG_ZSWAP_DEFAULT_ON is not set
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4=y
CONFIG_ZSWAP_COMPRESSOR_DEFAULT="lz4"
CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD=y
CONFIG_ZSWAP_ZPOOL_DEFAULT="zbud"

It's interesting because Zswap is a cache, not a different separate swap block device.
So when the cache is full, the oldest (and thus coldest) pages are moved to the on-disk (well, on-flash) swap. The most recent (and thus hottest) pages are still in the cache.

Whereas Zram is just another swap device. It's possible to give it a higher priority, so it gets used first. But once it's full, kernel will simply move onto the next highest priority swap block device. So there's risk that the RAM is used for very old pages which aren't used often anymore, while the flash is undergoing thrashing as the various active apps are swaped in and out of it.

(for reference, I use Zswap on both my laptops, including the closely related Pinebook Pro).

@DrYak
Copy link
Author

DrYak commented Oct 21, 2024

Note: recent kernels on other distro seem to be moving toward zsmalloc as default memory allocator for zswap.
It's the default allocator that Zram uses in SailfishOS so it's already compiled in anyway.
And in recent versions, zsmalloc has gained the capability to "evict" old cached pages to physical swap (which previously only zbud abd z3fold did support).

I would suggest changing:

CONFIG_ZSWAP_ZPOOL_DEFAULT="zsmalloc"

to follow the general trend (though I would suspect that bufs who know to use zswap will know to setup that on the u-boot command file anyway)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant