Compressed files & the page cache
Gao Xiang
hsiangkao at linux.alibaba.com
Wed Jul 16 20:18:18 PDT 2025
On 2025/7/17 10:49, Eric Biggers wrote:
> On Wed, Jul 16, 2025 at 11:37:28PM +0100, Phillip Lougher wrote:
...
> buffer. I suspect that vmap() (or vm_map_ram() which is what f2fs uses)
> is actually more efficient than these streaming APIs, since it avoids
> the internal copy. But it would need to be measured.
Of course vm_map_ram() (that is what erofs relies on first for
decompression in tree since 2018, then the f2fs one) will be
efficient for decompression and avoid polluting unnecessary
caching (considering typical PIPT or VIPT.)
Especially for large compressed extents such as 1MiB, another
memcpy() will cause much extra overhead over lz4.
But as for gzip, xz and zstd, they just implement internal lz77
dictionaries then memcpy for streaming APIs. Since those
algorithms are relatively slow (for example Zstd still relies
on Huffman and FSE), I don't think it causes much difference
to avoid memcpy() in the whole I/O path (because Huffman tree
and FSE table are already slow), but lz4 matters.
Thanks,
Gao Xiang
More information about the linux-mtd
mailing list