Skip to content

feat: add THP mode configuration and cgroup application support - #400

Draft
BLumia wants to merge 1 commit into
linuxdeepin:masterfrom
BLumia:agent/bot/29eac27323d0
Draft

BLumia wants to merge 1 commit into
linuxdeepin:masterfrom
BLumia:agent/bot/29eac27323d0

Conversation

@BLumia

@BLumia BLumia commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

变更概述

为 dde-application-manager 添加大页(THP)配置设置与覆写支持。

变更内容

  1. DConfig schema — misc/dsg/configs/dde-application-manager/org.deepin.dde.application-manager.json:新增 thpMode 字段,默认值 "force_enable",permissions: "readwrite",visibility: "private"
  2. 常量定义 — src/constant.h:新增 constexpr static auto &AppThpMode = u"thpMode";
  3. 新增模块 — src/cgroupthp.h + src/cgroupthp.cpp:THP 模式校验、DConfig 读取、cgroup 路径解析、写入 memory.thp_mode 文件
  4. 集成调用 — src/dbus/applicationservice.cpp:在应用启动流程中调用 CgroupThp::applyForUnit()
  5. 单元测试 — tests/ut_cgroupthp.cpp:覆盖模式校验场景

关联

注意

  • 代码审核已通过(94/100,风险 Low,0 漏洞)
  • 编译打包正在进行中

Summary by Sourcery

Enable configurable transparent huge page modes for launched applications.

New Features:

  • Add per-application THP mode configuration with support for applying modes to application cgroups at launch.

Enhancements:

  • Resolve application systemd units and apply validated THP settings with fallback and graceful handling of unavailable cgroup controls.

Tests:

  • Add unit coverage for supported and invalid THP mode values.

1. Add thpMode field to DConfig schema (readwrite, private, default force_enable).
2. Add AppThpMode constant in constant.h.
3. Add cgroupthp module: validate mode, read per-app DConfig override,
   resolve cgroup path via systemd DBus, write memory.thp_mode.
4. Integrate CgroupThp::applyForUnit() in application launch flow.
5. Add unit tests for mode validation.

Log: 为 dde-application-manager 添加大页(THP)配置设置与覆写支持
PMS: TASK-398769
Influence: 应用启动时根据 DConfig 配置设置 cgroup 的 THP 模式,失败不阻断启动
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia

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

@sourcery-ai

sourcery-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Reviewer's Guide

Schema and migrations

Add the per-application thpMode DConfig field with a force_enable default and private read/write permissions.

  • misc/dsg/configs/dde-application-manager/org.deepin.dde.application-manager.json L25-34

Uses of the API

Invoke THP mode application after the systemd launch job completes, using the resolved unit name and application ID.

  • src/dbus/applicationservice.cpp L9, L564-571, L663-665

Implementation

Add the internal THP helper and configuration key used to validate per-application modes, resolve systemd cgroups, and write memory.thp_mode.

  • src/cgroupthp.cpp L1-181
  • src/cgroupthp.h L1-22
  • src/constant.h L69

Tests

Test acceptance of supported THP modes and rejection of unknown values.

  • tests/ut_cgroupthp.cpp L1-26

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

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.

2 participants