Skip to content

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Dec 26, 2025

deepin inclusion
category: feature

Support module compress, and compress kernel modules to zstd format. Will help to less kernel module size which lays in user disk XXXMB.

It will decrease /lib/modules/xxx/kernel/../*.ko to *.ko.zst ~70%, but increase image.deb ~70%.

Log:
before:
image.deb 94MB
du -sh /lib/modules/xxx 520MB
after:
image.deb 158MB
du -sh /lib/modules/xxx 167MB
The point is that disksize cost is more expensive than network.

PS: do it in our 6.6 kernel need backport some KBUILDS commits, or will bring debuginfo to image.deb not image-dbg.deb...

Summary by Sourcery

New Features:

  • Enable zstd-compressed kernel modules in Deepin arm64, loongarch, and x86 desktop defconfig profiles.

@sourcery-ai
Copy link

sourcery-ai bot commented Dec 26, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Configures Deepin kernel builds to compress loadable kernel modules with zstd across all supported desktop defconfig architectures, trading a larger image.deb for a significantly smaller /lib/modules footprint on disk.

File-Level Changes

Change Details Files
Enable zstd-based kernel module compression in Deepin desktop defconfigs for all supported architectures.
  • Turn on kernel module compression option in Deepin desktop defconfig files
  • Select zstd as the compression algorithm for kernel modules instead of leaving modules uncompressed or using an alternative method
  • Align configuration across arm64, loongarch, and x86 desktop defconfigs to ensure consistent module packaging behavior
arch/arm64/configs/deepin_arm64_desktop_defconfig
arch/loongarch/configs/deepin_loongarch_desktop_defconfig
arch/x86/configs/deepin_x86_desktop_defconfig

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

deepin inclusion
category: feature

Support module compress, and compress kernel modules to zstd format.
Will help to less kernel module size which lays in user disk XXXMB.

It will decrease /lib/modules/xxx/kernel/../*.ko to *.ko.zst ~70%,
but increase image.deb ~70%.

Log:
before:
image.deb 94MB
du -sh /lib/modules/xxx 520MB
after:
image.deb 158MB
du -sh /lib/modules/xxx 167MB
The point is that disksize cost is more expensive than network.

PS: do it in our 6.6 kernel need backport some KBUILDS commits,
or will bring debuginfo to image.deb not image-dbg.deb...
Signed-off-by: Wentao Guan <[email protected]>
@opsiff opsiff force-pushed the linux-6.12.y-2025-12-26-zstd-module branch from f97311c to 28437b8 Compare December 26, 2025 11:14
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个配置文件的变更进行审查:

  1. 语法逻辑:

    • 配置项的语法格式正确,符合Linux内核配置文件的标准格式
    • 所有新增的配置项都放置在了合适的位置,与MODULE相关的配置项放在一起
  2. 代码质量:

    • 配置项的命名规范,遵循了内核配置的命名约定
    • 相关配置项组织在一起,便于维护和理解
    • 在三个不同的架构(arm64、loongarch、x86)中都进行了相同的配置变更,保持了一致性
  3. 代码性能:

    • CONFIG_MODULE_COMPRESS=y:启用模块压缩功能
    • CONFIG_MODULE_COMPRESS_ZSTD=y:使用ZSTD压缩算法,这是一个很好的选择,因为ZSTD提供了很好的压缩率和速度平衡
    • CONFIG_MODULE_DECOMPRESS=y:启用模块解压缩功能,这是模块压缩的必要配套功能
    • 这些配置会带来以下性能影响:
      • 正面:减少磁盘空间占用,加快模块加载速度(因为I/O减少)
      • 负面:增加少量CPU开销用于压缩/解压缩操作
    • 总体来说,性能影响是积极的,因为现代CPU的压缩/解压缩操作开销很小,而减少的I/O开销更显著
  4. 代码安全:

    • 模块压缩本身不会带来额外的安全风险
    • ZSTD是一个成熟、安全的压缩算法实现
    • 这些配置不会影响系统的安全性

改进建议:

  1. 建议在配置文件中添加注释说明这些新配置项的目的,例如:

    # Enable module compression using ZSTD for reduced disk space usage
    CONFIG_MODULE_COMPRESS=y
    CONFIG_MODULE_COMPRESS_ZSTD=y
    CONFIG_MODULE_DECOMPRESS=y
    
  2. 考虑添加相关的性能测试用例,以验证模块压缩在实际使用场景中的效果

  3. 建议在文档中记录这些配置变更,说明其对系统性能和存储空间的影响

  4. 可以考虑添加模块压缩级别的配置选项,以便根据具体需求调整压缩率:

    CONFIG_MODULE_COMPRESS_ZSTD_LEVEL=3
    

总的来说,这是一个很好的配置变更,能够在保持系统性能的同时减少存储空间占用。建议的改进主要是文档和可配置性方面的增强。

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lanlanxiyiji lanlanxiyiji merged commit 8f0cc6b into deepin-community:linux-6.12.y Dec 26, 2025
8 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lanlanxiyiji
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants