[Deepin-Kernel-SIG] [linux 6.18-y] [Openeuler] cgroup: disable kernel memory accounting for all memory cgroups by de… - #2012
Conversation
…fault hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8QLND CVE: NA ---------------------------------------- The kernel memory accounting for all memory cgroups is not stable, and it will cause a 100% regression in hackbench compared with kernel-4.19, so disable it by default. We can use the following command line to enable or disable it: cgroup.memory=kmem or cgroup.memory=nokmem. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> Signed-off-by: chenridong <chenridong@huawei.com> Signed-off-by: Wentao Guan <guanwentao@uniontech.com> (cherry picked from commit 53fbd8c) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR disables kernel memory accounting for memory cgroups by default and adds an explicit kernel parameter switch to re‑enable it, updating the memory cgroup documentation and kernel parameters docs accordingly. Flow diagram for cgroup_memory kernel parameter handlingflowchart TD
A[Boot_with_kernel_parameters] --> B[cgroup_memory parses parameters]
B --> C{token_is_nokmem}
B --> D{token_is_kmem}
C -- yes --> E[set cgroup_memory_nokmem = true]
C -- no --> F[no_change_from_nokmem]
D -- yes --> G[set cgroup_memory_nokmem = false]
D -- no --> H[no_change_from_kmem]
I[default] --> J[cgroup_memory_nokmem = true]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
So 6.6.y needs this too? |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="Documentation/admin-guide/cgroup-v1/memory.rst" line_range="332-334" />
<code_context>
-at boot time. In this case, kernel memory will not be accounted at all.
+Kernel memory accounting is disabled for all memory cgroups by default. But
+it can be enabled system-wide by passing cgroup.memory=kmem to the kernel
+at boot time. In this case, kernel memory will all be accounted.
Kernel memory limits are not imposed for the root cgroup. Usage for the root
</code_context>
<issue_to_address>
**suggestion (typo):** Clarify the phrasing "kernel memory will all be accounted" for better grammar.
Consider rephrasing to "kernel memory will be fully accounted" or "all kernel memory will be accounted for" to improve grammar and clarity.
```suggestion
Kernel memory accounting is disabled for all memory cgroups by default. But
it can be enabled system-wide by passing cgroup.memory=kmem to the kernel
at boot time. In this case, kernel memory will be fully accounted.
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| Kernel memory accounting is disabled for all memory cgroups by default. But | ||
| it can be enabled system-wide by passing cgroup.memory=kmem to the kernel | ||
| at boot time. In this case, kernel memory will all be accounted. |
There was a problem hiding this comment.
suggestion (typo): Clarify the phrasing "kernel memory will all be accounted" for better grammar.
Consider rephrasing to "kernel memory will be fully accounted" or "all kernel memory will be accounted for" to improve grammar and clarity.
| Kernel memory accounting is disabled for all memory cgroups by default. But | |
| it can be enabled system-wide by passing cgroup.memory=kmem to the kernel | |
| at boot time. In this case, kernel memory will all be accounted. | |
| Kernel memory accounting is disabled for all memory cgroups by default. But | |
| it can be enabled system-wide by passing cgroup.memory=kmem to the kernel | |
| at boot time. In this case, kernel memory will be fully accounted. |
There was a problem hiding this comment.
Pull request overview
Disables kernel memory accounting for memory cgroups by default (to avoid reported performance regressions/instability) and adds a boot-time switch to re-enable it, updating the associated admin documentation.
Changes:
- Set
cgroup_memory_nokmemdefault totrue, disabling kmem accounting unless overridden. - Extend
cgroup.memory=boot parameter parsing to acceptkmem(re-enables kmem accounting). - Update kernel parameter and cgroup-v1 memory controller documentation to describe the new default and toggle.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mm/memcontrol.c | Defaults kernel memory accounting to disabled and adds cgroup.memory=kmem parsing to re-enable it. |
| Documentation/admin-guide/kernel-parameters.txt | Documents the new cgroup.memory=kmem option. |
| Documentation/admin-guide/cgroup-v1/memory.rst | Updates the narrative to reflect kmem accounting being disabled by default and how to enable it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Kernel memory accounting is disabled for all memory cgroups by default. But | ||
| it can be enabled system-wide by passing cgroup.memory=kmem to the kernel | ||
| at boot time. In this case, kernel memory will all be accounted. |
6.6.y had it long long ago..... |
…fault
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8QLND CVE: NA
The kernel memory accounting for all memory cgroups is not stable, and it will cause a 100% regression in hackbench compared with kernel-4.19, so disable it by default. We can use the following command line to enable or disable it:
cgroup.memory=kmem or cgroup.memory=nokmem.
(cherry picked from commit 53fbd8c)
Summary by Sourcery
Disable kernel memory accounting for memory cgroups by default and add a kernel parameter option to re-enable it.
Bug Fixes:
Documentation: