[暂不合并]feat(systemd): add THP disable pre-start for DDE services#209
Open
mhduiy wants to merge 1 commit into
Open
[暂不合并]feat(systemd): add THP disable pre-start for DDE services#209mhduiy wants to merge 1 commit into
mhduiy wants to merge 1 commit into
Conversation
1. Added ExecStartPre directive to disable Transparent Huge Pages (THP) before DDE core services start 2. Applied to 5 services: dde-shell desktop plugin, dde-shell DDE, dde-lock, dde-polkit-agent, and dde-session@x11 3. Uses `-` prefix on dde-thp-disable to gracefully handle cases where the binary is absent Log: Disable THP before DDE session services start to reduce memory overhead feat(systemd): 为 DDE 服务添加 THP 禁用预启动步骤 1. 在 DDE 核心服务启动前添加 ExecStartPre 指令,用于禁用透明大页(THP) 2. 覆盖 5 个服务:dde-shell 桌面插件、dde-shell DDE、dde-lock、dde-polkit-agent、dde-session@x11 3. 对 dde-thp-disable 使用 `-` 前缀,避免二进制文件缺失时启动失败 Log: 在 DDE 会话服务启动前禁用 THP 以减少内存开销 PMS: TASK-390043
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的 Git Diff 内容。本次修改主要在多个 DDE (Deepin Desktop Environment) 的 systemd 服务单元文件中添加了 以下是我从语法逻辑、代码质量、代码性能和代码安全四个维度提出的详细审查意见和改进建议: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结与修改示例总体评价:修改意图明确,systemd 语法使用正确,但存在逻辑冗余、潜在的性能浪费以及需要高度关注的权限安全问题。 改进后的代码示例(以添加注释和优化 x11 服务的顺序为例): diff --git a/systemd/dde-session-core.target.wants/dde-shell-plugin@org.deepin.ds.desktop.service b/systemd/dde-session-core.target.wants/dde-shell-plugin@org.deepin.ds.desktop.service
index 4452fdb..d10ee93 100644
--- a/systemd/dde-session-core.target.wants/dde-shell-plugin@org.deepin.ds.desktop.service
+++ b/systemd/dde-session-core.target.wants/dde-shell-plugin@org.deepin.ds.desktop.service
@@ -18,6 +18,8 @@ After=dbus.socket
Type=dbus
BusName=com.deepin.dde.desktop
ExecStart=/usr/bin/dde-shell -p %I
+# Disable THP to prevent performance degradation/latency on specific hardware (Ref: Bug #XXXX)
+ExecStartPre=-/usr/libexec/dde-thp-disable
TimeoutStartSec=infinity
Slice=session.slice
Restart=always
diff --git a/systemd/dde-session-pre.target.wants/dde-session@x11.service b/systemd/dde-session-pre.target.wants/dde-session@x11.service
index 5ff802a..77d87b4 100644
--- a/systemd/dde-session-pre.target.wants/dde-session@x11.service
+++ b/systemd/dde-session-pre.target.wants/dde-session@x11.service
@@ -14,7 +14,9 @@ StartLimitBurst=3
[Service]
Slice=session.slice
Type=notify
-ExecStartPre=-/bin/sh -c 'cp -n /etc/xdg/kglobalshortcutsrc "$HOME/.config/kglobalshortcutsrc"; sed -i "s/deepin-kwin/kwin/g" "$HOME/.config/kglobalshortcutsrc"'
+# Disable THP first to ensure consistent memory behavior before GUI starts
+ExecStartPre=-/usr/libexec/dde-thp-disable
+ExecStartPre=-/bin/sh -c 'cp -n /etc/xdg/kglobalshortcutsrc "$HOME/.config/kglobalshortcutsrc"; sed -i "s/deepin-kwin/kwin/g" "$HOME/.config/kglobalshortcutsrc"'
ExecStart=/usr/bin/kwin_x11 --replace
# Exit code 1 means we are probably *not* dealing with an extension failure强烈建议的下一步行动:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-prefix on dde-thp-disable to gracefully handle cases where the binary is absentLog: Disable THP before DDE session services start to reduce memory overhead
feat(systemd): 为 DDE 服务添加 THP 禁用预启动步骤
-前缀,避免二进制文件缺失时启动失败Log: 在 DDE 会话服务启动前禁用 THP 以减少内存开销
PMS: TASK-390043