PM: hibernate: Add support for LZ4 compression for hibernation
authorNikhil V <quic_nprakash@quicinc.com>
Mon, 22 Jan 2024 13:15:27 +0000 (18:45 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 5 Feb 2024 13:30:35 +0000 (14:30 +0100)
commit8bc29736357e7f9a6bd0d16b57b5612197e1924b
treeb2942acf48cca582067198e2e8296ba030df1ce9
parenta06c6f5d3cc90b3b070d7b99979d57238db77a86
PM: hibernate: Add support for LZ4 compression for hibernation

Extend the support for LZ4 compression to be used with hibernation.
The main idea is that different compression algorithms
have different characteristics and hibernation may benefit when it uses
any of these algorithms: a default algorithm, having higher
compression rate but is slower(compression/decompression) and a
secondary algorithm, that is faster(compression/decompression) but has
lower compression rate.

LZ4 algorithm has better decompression speeds over LZO. This reduces
the hibernation image restore time.
As per test results:
                                    LZO             LZ4
Size before Compression(bytes)   682696704       682393600
Size after Compression(bytes)    146502402       155993547
Decompression Rate               335.02 MB/s     501.05 MB/s
Restore time                       4.4s             3.8s

LZO is the default compression algorithm used for hibernation. Enable
CONFIG_HIBERNATION_COMP_LZ4 to set the default compressor as LZ4.

Signed-off-by: Nikhil V <quic_nprakash@quicinc.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/Kconfig
kernel/power/hibernate.c
kernel/power/power.h