[RFC PATCH 0/3] Introduce per-cgroup compression priority
Nhat Pham
nphamcs at gmail.com
Mon Oct 27 23:46:10 CET 2025
On Sat, Oct 25, 2025 at 6:53 PM jinji zhong <jinji.z.zhong at gmail.com> wrote:
>
> Hello everyone,
>
> On Android, different applications have varying tolerance for
> decompression latency. Applications with higher tolerance for
> decompression latency are better suited for algorithms like ZSTD,
> which provides high compression ratio but slower decompression
> speed. Conversely, applications with lower tolerance for
> decompression latency can use algorithms like LZ4 or LZO that
> offer faster decompression but lower compression ratios. For example,
> lightweight applications (with few anonymous pages) or applications
> without foreground UI typically have higher tolerance for decompression
> latency.
>
> Similarly, in memory allocation slow paths or under high CPU
> pressure, using algorithms with faster compression speeds might
> be more appropriate.
>
> This patch introduces a per-cgroup compression priority mechanism,
> where different compression priorities map to different algorithms.
> This allows administrators to select appropriate compression
> algorithms on a per-cgroup basis.
>
> Currently, this patch is experimental and we would greatly
> appreciate community feedback. I'm uncertain whether obtaining
> compression priority via get_cgroup_comp_priority in zram is the
> best approach. While this implementation is convenient, it seems
> somewhat unusual. Perhaps the next step should be to pass
> compression priority through page->private.
I agree with TJ's and Shakeel's take on this. You (or some other
zram/zswap users) will have to present a more compelling case for the
necessity of a hierarchical structure for this property :)
The semantics itself is unclear to me - what's the default? How should
inheritance be defined? What happens when cgroups are killed etc?
As a side note, seems like there is a proposal for swap device
priority (+ Youngjun)
https://lore.kernel.org/all/20250716202006.3640584-1-youngjun.park@lge.com/
Is this something you can leverage?
Another alternative is to make this zram-internal, i.e add knobs to
zram sysfs, or extend the recomp parameter. I'll defer to zram
maintainers and users to comment on this :)
More information about the drbd-dev
mailing list