hibernate: improve crc32 speed by calc compressed data

This commit introduce crc32 calc data by compressed instead of
uncompressed data. This improve speed of hibernation resume data
about 10% :

Change-Id: I9a90006fd42430c0fe4ba712e48fee325068ec01

------with this commmit-----
PM: hibernation: Read 788072 kbytes in 2.21 seconds (356.59 MB/s)

-----berfore this commit----
PM: hibernation: Read 786300 kbytes in 2.45 seconds (320.93 MB/s)

Before this the crc32 of data is uncompress origin data,which is
huge.
The risk of this change is we not checked the origin data, but
the compressed data is check ok can equal to uncompressed data
ok mostly. For the data become invalid mostly is from disk,
for example : human mistook erasing.

Signed-off-by: xianbing Zhu <xianbing.zhu@linux.alibaba.com>
Change-Id: I7e8d968373667fa4532f527f6a63c37711169711
This commit is contained in:
xianbing Zhu
2024-02-19 17:13:27 +08:00
committed by Han Gao
parent 4e582eb6b3
commit 32539f0dc7

View File

@@ -634,7 +634,7 @@ static int lzo_compress_threadfn(void *data)
d->wrk);
lzo_head = (struct hib_lzo_header *)d->cmp;
lzo_head->cmp_len = d->cmp_len;
lzo_head->unc_crc32 = crc32_le(0,d->unc, d->unc_len);
lzo_head->unc_crc32 = crc32_le(0,d->cmp + LZO_HEADER, d->cmp_len);
atomic_set(&d->stop, 1);
wake_up(&d->done);
}
@@ -1087,7 +1087,7 @@ static int lzo_decompress_threadfn(void *data)
d->ret = lzo1x_decompress_safe(d->cmp + LZO_HEADER, d->cmp_len,
d->unc, &d->unc_len);
unc_crc32 = crc32_le(0,d->unc, d->unc_len);
unc_crc32 = crc32_le(0,d->cmp + LZO_HEADER, d->cmp_len);
if(unc_crc32 != get_header_crc32((struct hib_lzo_header *)&d->cmp) ) {
d->crc32_err++;
}