RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2032758 - Enable zstd compression functionality for the kernel
Summary: Enable zstd compression functionality for the kernel
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: kernel
Version: CentOS Stream
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Vladis Dronov
QA Contact: ChanghuiZhong
URL:
Whiteboard:
Depends On:
Blocks: 2034834
TreeView+ depends on / blocked
 
Reported: 2021-12-15 07:04 UTC by Neal Gompa
Modified: 2022-05-17 15:54 UTC (History)
9 users (show)

Fixed In Version: kernel-5.14.0-44.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 15:43:16 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab cki-project kernel-ark merge_requests 1528 0 None None None 2021-12-15 08:09:49 UTC
Gitlab redhat/centos-stream/src/kernel centos-stream-9 merge_requests 262 0 None None None 2021-12-15 07:59:05 UTC
Red Hat Issue Tracker RHELPLAN-105835 0 None None None 2021-12-15 07:15:35 UTC
Red Hat Product Errata RHBA-2022:3907 0 None None None 2022-05-17 15:43:31 UTC

Description Neal Gompa 2021-12-15 07:04:05 UTC
Description of problem:
Currently the kernel does not have zstd compression functionality turned on (CONFIG_CRYPTO_ZSTD=m, CONFIG_ZSTD_COMPRESS=m).

Let's have the capability turned on so that it's available for users. Having zstd support on makes it possible for third-party modules to leverage them (by the CentOS Kmods SIG, for example).

Additional info:
This was discussed previously in https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/110#note_775939397

Comment 5 Vladis Dronov 2021-12-28 02:14:01 UTC
a suggested action plan for testing: use zram disk with zstd compression

docs: https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html

### create one zram device
# modprobe zram num_devices=1

### check and set zstd compression 
# cat /sys/block/zram0/comp_algorithm 
lzo [lzo-rle] lz4 lz4hc 842 zstd 
# echo zstd > /sys/block/zram0/comp_algorithm
# cat /sys/block/zram0/comp_algorithm 
lzo lzo-rle lz4 lz4hc 842 [zstd] 
< *** the output must contain "[zstd]" here *** >

### set max ram usage = 256 Mbytes
# echo 256M > /sys/block/zram0/disksize

### write, read and test some data (/boot, for example)
# mke2fs -m 0 -b 4096 -O sparse_super -L zram /dev/zram0
# mount -o relatime,noexec,nosuid /dev/zram0 /mnt/zram
# cp -rp /boot /mnt/zram
# diff -rp /boot /mnt/zram/boot
< *** must be no output here *** >

### get funny stats
# awk '{ print "uncompressed size of data",$1,"\ncompressed size of data", $2, "\nmemory allocated for this disk", $3, "\nnumber of incompressible pages", $8 }' /sys/block/zram0/mm_stat
uncompressed size of data 185937920 
compressed size of data 163488509 
memory allocated for this disk 164663296 
number of incompressible pages 36615

### uncreate
# umount /mnt/zram
# rmmod zram

Comment 8 Neal Gompa 2022-01-11 01:19:58 UTC
Can someone unmark this as "redhat" private? I think that got set by accident...

Comment 12 Vladis Dronov 2022-01-14 15:29:50 UTC
(In reply to Vladis Dronov from comment #5)
> a suggested action plan for testing: use zram disk with zstd compression

hi, Changhui,

i need to make a change to the suggested testing plan in #c5. in the current
version we will be reading data from a page cache, not from zram disk, so
compare operation will always succeed.

can you please consider the following change in a testing script:

...
### write some data (/boot, for example), un-mount and drop caches
# mkdir -p /mnt/zram
# mke2fs -m 0 -b 4096 -O sparse_super -L zram /dev/zram0
# mount -o relatime,noexec,nosuid /dev/zram0 /mnt/zram
# cp -rp /boot /mnt/zram
# umount /mnt/zram
# echo 3 > /proc/sys/vm/drop_caches

### test the data
# mount -o relatime,noexec,nosuid /dev/zram0 /mnt/zram
# diff -rp /boot /mnt/zram/boot
< *** must be no output here *** >

### clean up
# umount /mnt/zram
# rmdir /mnt/zram
# rmmod zram

Comment 13 ChanghuiZhong 2022-01-17 09:51:27 UTC
Tested on 5.14.0-39.mrs_262_292.el9 with good results, 
zstd compression functionality has enabled, zstd smoke and zstd compression test passed.

# grep CONFIG_CRYPTO_ZSTD /boot/config-5.14.0-39.mrs_262_292.el9.x86_64
CONFIG_CRYPTO_ZSTD=m

# grep CONFIG_ZSTD_COMPRESS /boot/config-5.14.0-39.mrs_262_292.el9.x86_64
CONFIG_ZSTD_COMPRESS=m

:: [ 04:27:09 ] :: [  BEGIN   ] :: Running 'uname -a'
Linux storageqe-70.rhts.eng.pek2.redhat.com 5.14.0-39.mrs_262_292.el9.x86_64 #1 SMP PREEMPT Fri Jan 14 07:51:34 EST 2022 x86_64 x86_64 x86_64 GNU/Linux

::[04:27:09]::[BEGIN]:: Running 'cat /sys/block/zram0/comp_algorithm'
lzo lzo-rle [zstd]


::[04:27:11]::[BEGIN]:: Running 'diff -rp /boot /mnt/zram/boot'
:: [ 04:27:12 ] :: [ PASS ] :: Command 'diff -rp /boot /mnt/zram/boot' (Expected 0, got 0)


uncompressed size of data 261521408
compressed size of data 233442811
memory allocated for this disk 234971136
number of incompressible pages 52081

Comment 17 ChanghuiZhong 2022-01-24 09:37:12 UTC
Tested on kernel-5.14.0-47.el9,
zstd compression functionality has enabled, zstd smoke and zstd compression test passed
https://beaker.engineering.redhat.com/jobs/6216984

# grep CONFIG_CRYPTO_ZSTD /boot/config-5.14.0-47.el9.x86_64 
CONFIG_CRYPTO_ZSTD=m
# grep CONFIG_ZSTD_COMPRESS /boot/config-5.14.0-47.el9.x86_64 
CONFIG_ZSTD_COMPRESS=m

move to verified

Comment 19 errata-xmlrpc 2022-05-17 15:43:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: kernel), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3907


Note You need to log in before you can comment on or make changes to this bug.