• Gao Xiang's avatar
    erofs: avoid refcounting short-lived pages · 1001042e
    Gao Xiang authored
    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: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20240711053659.1364989-1-hsiangkao@linux.alibaba.com
    1001042e
decompressor.c 14.8 KB