Re: [RFC PATCH 0/3] Introduce per-cgroup compression priority
Nhat Pham <[email protected]> Mon, 27 Oct 2025 15:46:10 -0700
| Newsgroups | dev.linux.lists.drbd-dev,org.kernel.vger.cgroups,org.kernel.vger.linux-block,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <CAKEwX=MqsyWki+DfzePb3SwXWTZ_2tcDV-ONBQu62=otnBXCiQ@mail.gmail.com> |
On Sat, Oct 25, 2025 at 6:53 PM jinji zhong <[email protected]> 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/[email protected]/ 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 :)