]> www.infradead.org Git - users/jedix/linux-maple.git/commit
zram: add dictionary support to zstd backend
authorSergey Senozhatsky <senozhatsky@chromium.org>
Fri, 12 Jul 2024 05:18:33 +0000 (14:18 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:52:32 +0000 (17:52 -0700)
commit7b9716ba907f916ddd17f60652509a0501acc9c1
treed8748a713cbdee3d54f6eb1f0475edf30f10e5a0
parentf92d2f891a4b17354b98e253764ea2b750f8eace
zram: add dictionary support to zstd backend

This adds support for pre-trained zstd dictionaries [1]
Dictionary is setup in params once (per-comp) and loaded
to Cctx and Dctx by reference, so we don't allocate extra
memory.

TEST
====

*** zstd
/sys/block/zram0/mm_stat
1750654976 504565092 514203648        0 514203648        1        0    34204    34204

*** zstd dict=/home/ss/zstd-dict-amd64
/sys/block/zram0/mm_stat
1750638592 465851259 475373568        0 475373568        1        0    34185    34185

*** zstd level=8 dict=/home/ss/zstd-dict-amd64
/sys/block/zram0/mm_stat
1750642688 430765171 439955456        0 439955456        1        0    34185    34185

[1] https://github.com/facebook/zstd/blob/dev/programs/zstd.1.md#dictionary-builder

Link: https://lkml.kernel.org/r/20240712051850.484318-23-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/zram/backend_zstd.c