fix(kernelmod): page-align ring buffer allocation for non-4K page kernels - #255
Merged
deepin-bot[bot] merged 1 commit intoSep 2, 2026
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFix ring-buffer mmap failures on kernels with non-4K pages by aligning the allocated and recorded buffer size to PAGE_SIZE, keeping it consistent with the page-aligned userspace mapping. Sequence diagram for page-aligned ring buffer mmapsequenceDiagram
participant Init as vfs_ring_init
participant Kernel as Kernel memory allocator
participant User as Userspace consumer
Init->>Init: PAGE_ALIGN(header_size + data_size)
Init->>Kernel: vzalloc(alloc_size)
Kernel-->>Init: ring->mem
Init->>Init: ring->mem_size = alloc_size
User->>Init: mmap(page-aligned size)
Init-->>User: mapping accepted when size <= mem_size
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…nels vzalloc rounds up to whole pages, but mem_size recorded the raw header+data total. On 16 KiB/64 KiB page kernels the consumer's page-aligned mmap was larger than mem_size and got rejected. 将 ring buffer 分配大小在 vzalloc 前显式按页对齐,使分配请求、 记录的 mem_size 与用户态 mmap 映射大小保持一致,修复非 4K 页 内核上 mmap 报 "size > mem_size" 导致模块不可用的问题。 Log: 修复非4K页内核上mmap大小检查失败 PMS: BUG-374927 Influence: 修复在 Loongson 等非4K页内核上 vfs_monitor 模块 mmap 失败导致服务不可用的问题。
max-lvs
approved these changes
Sep 2, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: max-lvs, wangrong1069 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
|
/merge |
deepin-bot
Bot
merged commit Sep 2, 2026
0ef5e11
into
linuxdeepin:develop/eagle-1070
17 checks passed
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.
vzalloc rounds up to whole pages, but mem_size recorded the raw header+data total. On 16 KiB/64 KiB page kernels the consumer's page-aligned mmap was larger than mem_size and got rejected.
将 ring buffer 分配大小在 vzalloc 前显式按页对齐,使分配请求、
记录的 mem_size 与用户态 mmap 映射大小保持一致,修复非 4K 页
内核上 mmap 报 "size > mem_size" 导致模块不可用的问题。
Log: 修复非4K页内核上mmap大小检查失败
PMS: BUG-374927
Influence: 修复在 Loongson 等非4K页内核上 vfs_monitor 模块 mmap 失败导致服务不可用的问题。
Summary by Sourcery
Bug Fixes: