]> www.infradead.org Git - users/jedix/linux-maple.git/commit
erofs: avoid refcounting short-lived pages
authorGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 11 Jul 2024 05:36:59 +0000 (13:36 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 11 Jul 2024 07:14:26 +0000 (15:14 +0800)
commit1001042e54ef324c0c665b60a012519be05ae022
tree65742498ae8692f4ff4374a6d4cc672d24d1d75b
parent1c076f1f4d7fc7cfb45dba10b3b49d574b4c4c28
erofs: avoid refcounting short-lived pages

LZ4 always reuses the decompressed buffer as its LZ77 sliding window
(dynamic dictionary) for optimal performance.  However, in specific
cases, the output buffer may not fully contain valid page cache pages,
resulting in the use of short-lived pages for temporary purposes.

Due to the limited sliding window size, LZ4 shortlived bounce pages can
also be reused in a sliding manner, so each bounce page can be vmapped
multiple times in different relative positions by design.  In order to
avoiding double frees, currently, reuse counts are recorded via page
refcount, but it will no longer be used as-is in the future world of
Memdescs.

Just maintain a lookup table to check if a shortlived page is reused.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240711053659.1364989-1-hsiangkao@linux.alibaba.com
fs/erofs/compress.h
fs/erofs/decompressor.c
fs/erofs/zdata.c