Skip to content

Conversation

@fslongjin
Copy link
Member

  • Mark filemap prefaulted pages with insert_vma to keep map_count consistent with mappings.
  • Avoid redundant mapping in filemap_map_pages when a PTE already exists.
  • Ensure page-cache created pages are fully initialized and UPTODATE.

Motivation

Setting PG_UPTODATE enables prefault mapping via filemap_map_pages. Those pages were mapped without updating vma_set, causing map_count to stay at 0 and enabling reclaim/writeback paths to treat mapped pages as unmapped, leading to mmap hangs. The fix aligns VMA tracking with prefault mappings and adds diagnostics to validate mapping correctness.

- Mark filemap prefaulted pages with insert_vma to keep map_count consistent with mappings.
- Avoid redundant mapping in filemap_map_pages when a PTE already exists.
- Ensure page-cache created pages are fully initialized and UPTODATE.

**Motivation**

Setting PG_UPTODATE enables prefault mapping via filemap_map_pages.
Those pages were mapped without updating vma_set, causing map_count to stay at 0
and enabling reclaim/writeback paths to treat mapped pages as unmapped, leading to mmap hangs.
The fix aligns VMA tracking with prefault mappings and adds diagnostics to
validate mapping correctness.

Signed-off-by: longjin <longjin@DragonOS.org>
@github-actions github-actions bot added the Bug fix A bug is fixed in this pull request label Jan 16, 2026
@fslongjin fslongjin merged commit 1e29f81 into DragonOS-Community:master Jan 16, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug fix A bug is fixed in this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant