Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough本次变更扩展了 SMP、IPI、TLB shootdown、CPU 拓扑、平台启动、中断、任务调度、地址空间、futex、Ext4 并发保护及 QEMU 资源配置,并新增相关错误类型、特性开关和初始化流程。 ChangesSMP、平台与内核并发
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces multi-core (SMP) and Inter-Processor Interrupt (IPI) support across the ArceOS runtime, memory management, and task scheduling modules, including platform-specific updates for RISC-V 64 and LoongArch64. Key enhancements include DTB-based CPU topology parsing, safe task migration, deferred waking, and multi-core TLB shootdowns. Feedback on these changes highlights three important issues: a critical infinite busy-wait loop in the garbage collection task when a task's reference count is greater than one, a potential concurrency race condition when assuming a single page table lock across page boundaries during allocation, and a false BadAddress error for zero-length unaligned writes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
PR Summary by QodoInitial SMP bring-up: CPU online tracking, IPIs, and 8G RAM boot fixes
AI Description
Diagram
High-Level Assessment
Files changed (59)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
5 rules 1.
|
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
arceos/modules/axtask/src/run_queue.rs (1)
732-755: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift不要让外部任务引用无限期保留已退出任务的内核栈。
只要调用方保留 join handle 或
AxTaskRef,strong_count就不会降到 1,此任务会被永久放回EXITED_TASKS,其kstack也始终无法释放。上下文切出完成后应独立回收栈,而不是要求整个任务对象没有其他观察者。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@arceos/modules/axtask/src/run_queue.rs` around lines 732 - 755, Update gc_entry’s exited-task cleanup so kernel stack reclamation is independent of external join handles or AxTaskRef ownership. After the task’s context switch-out is complete, release its kstack even when Arc::strong_count(&task) is greater than one, while retaining the task object for remaining observers and avoiding repeated stack cleanup.pulse_core/src/task/thread.rs (1)
252-263: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win不要让合法的
clear_child_tid映射因缺页而跳过 futex 唤醒。
write_user_u32_no_fault不会处理尚未驻留或需要 COW 的有效页面;这里的?随后会直接跳过 futex wake,可能令pthread_join永久等待。退出路径仍持有有效地址空间,应保留可缺页写入。建议修复
- self.process().write_user_u32_no_fault(clear_child_tid, 0)?; + self.process().write_user_u32(clear_child_tid, 0)?;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pulse_core/src/task/thread.rs` around lines 252 - 263, 将 clear_child_tid_on_exit 中的 write_user_u32_no_fault 替换为可处理缺页和 COW 的常规用户态 u32 写入接口,确保合法但未驻留的 clear_child_tid 映射仍能完成清零;保留后续两次 futex_wake_no_resched 调用及现有错误传播行为。
🧹 Nitpick comments (1)
arceos/modules/axfs/src/fs/ext4/inode.rs (1)
544-544: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy lift避免用 filesystem-wide 锁串行化所有目录修改。
这把锁在磁盘读写、inode 分配/删除和缓存失效期间一直持有,会让不同目录之间的 create/link/unlink/rename 完全串行,削弱 SMP 下的并发能力。若 ext4plus 的底层操作已具备足够保护,建议改为按目录或按目录对锁定;否则至少缩短锁的 I/O 持有范围。
Also applies to: 612-612, 639-639, 693-693
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@arceos/modules/axfs/src/fs/ext4/inode.rs` at line 544, 移除 create/link/unlink/rename 路径中通过 self.fs.directory_mutation 获取的 filesystem-wide 锁,避免不同目录操作被全局串行化;改用按目录或目录对的锁保护共享状态,或至少将锁定范围缩短至必要的元数据更新,不要覆盖磁盘 I/O、inode 分配/删除及缓存失效流程。同步处理 inode.rs 中其他对应的 directory_mutation 使用点。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@arceos/modules/axhal/src/dummy.rs`:
- Around line 94-99: Update the Dummy implementation’s cpu_boot method to return
axplat::power::CpuBootError::NotSupported instead of Ok(()), preserving its
existing signature and unused parameters so callers skip waiting for unsupported
secondary-CPU startup.
In `@arceos/modules/axipi/src/lib.rs`:
- Around line 116-128: 修复 TLB shootdown 发送流程中的部分失败处理:在包含 target_tickets 递增和 IPI
发送的调用路径中,不要让 send_ipi 的 ? 提前返回而遗留未完成票据。发送失败时应先完成或回滚所有已发布请求,并保持已刷新 CPU
与票据状态一致,使调用方能够安全重试。
In `@arceos/modules/axmm/src/aspace.rs`:
- Around line 959-969: Update flush_tlb_asid_all to stop using expect on
axipi::flush_tlb_all_cpus; propagate or return its Result so callers can handle
TLB shootdown failures without panicking. Ensure the surrounding
address-space/page-table update flow handles failure through CPU lifecycle
synchronization or rollback, so no remote stale TLB remains after an
unsuccessful shootdown.
In `@arceos/modules/axruntime/src/lib.rs`:
- Around line 182-188: CPU 在 IPI handler 和 IRQ 准备完成前被标记为
ready/online,可能导致请求滞留或同步等待死锁。更新 arceos/modules/axruntime/src/lib.rs:182-188,将主
CPU 的 axhal::mark_cpu_online 发布移至 axipi::init 与 axipi::mark_current_cpu_ready
完成之后;更新 arceos/modules/axruntime/src/mp.rs:66-82,使次级 CPU 仅在启用 IRQ
后发布,或在启动屏障中安全处理固定的 TLB mailbox。
In `@arceos/modules/axruntime/src/mp.rs`:
- Around line 30-36: 调整 cpu_boot 错误处理流程,不要将 CpuBootError::AlreadyOn 当作普通启动失败清除
BOOTED_CPU_MASK;为 AlreadyOn 增加单独的已启动 CPU 确认与计数路径,确保与 rust_main_secondary 的
INITED_CPUS 增加保持一致并满足 is_init_ok() 的计数条件,同时保留其他错误的现有清除和重试行为。
In `@arceos/scripts/make/qemu.mk`:
- Line 26: Update the MEM assignment to use a default-only value instead of
forcibly overriding user input, so command-line values such as make MEM=1G are
preserved while 8G remains the fallback for unspecified configurations.
In `@crates/axplat-loongarch64-qemu-virt/src/irq.rs`:
- Around line 87-98: Update the local IRQ unregister path around TIMER_HANDLER
and IPI_HANDLER so unregistering either global handler disables the
corresponding interrupt line on every online CPU, not only the calling CPU. Use
the existing cross-CPU execution mechanism and preserve the current per-CPU
set_enable behavior for external IRQ handlers; alternatively, reject
local-handler unregistration while SMP CPUs are online.
In `@crates/axplat-loongarch64-qemu-virt/src/mp.rs`:
- Around line 17-20: Update the stack validation in the boot path around
valid_stack_top to validate against each actual RAM segment from RAM_RANGES
instead of the single PHYS_MEMORY_BASE/PHYS_MEMORY_SIZE interval. Expose
RAM_RANGES as pub(crate) if needed, and accept the stack only when it falls
within at least one configured range; otherwise return
CpuBootError::InvalidAddress.
In `@crates/axplat-riscv64-qemu-virt/src/mem.rs`:
- Around line 90-105: 更新 push_u64_range 及其调用方,使 RangeList::push
的容量溢出状态能够向上传递;在收集 DTB、memreserve 和 reserved-memory 条目时检查失败结果,任何保留区间无法加入
candidates 都必须终止启动或采取等效的 fail-closed 策略,禁止继续发布不完整的内存布局。
In `@pulse_core/src/task/process.rs`:
- Around line 2751-2759: 在创建 queues 的流程中同时保存每个 waiter 入队时计算出的 futex `(key,
is_priv)`,并将其传递到清理阶段。更新 `futex_key` 相关逻辑,清理时直接复用已保存的 key
和私有性标记,不要根据当前地址重新计算;保持私有表与 `GLOBAL_FUTEX_TABLE` 的现有分支清理行为。
In `@pulse_syscalls/src/handler.rs`:
- Line 111: 调整 syscall 返回路径中 axtask::current().clear_interrupt() 的位置:将其移到 Line
88 对中断状态进行检查之前,用于清除旧状态;检查完成后不要再无条件清除,确保检查期间到达的新中断保持锁存并由后续可中断阻塞 syscall 处理。
---
Outside diff comments:
In `@arceos/modules/axtask/src/run_queue.rs`:
- Around line 732-755: Update gc_entry’s exited-task cleanup so kernel stack
reclamation is independent of external join handles or AxTaskRef ownership.
After the task’s context switch-out is complete, release its kstack even when
Arc::strong_count(&task) is greater than one, while retaining the task object
for remaining observers and avoiding repeated stack cleanup.
In `@pulse_core/src/task/thread.rs`:
- Around line 252-263: 将 clear_child_tid_on_exit 中的 write_user_u32_no_fault
替换为可处理缺页和 COW 的常规用户态 u32 写入接口,确保合法但未驻留的 clear_child_tid 映射仍能完成清零;保留后续两次
futex_wake_no_resched 调用及现有错误传播行为。
---
Nitpick comments:
In `@arceos/modules/axfs/src/fs/ext4/inode.rs`:
- Line 544: 移除 create/link/unlink/rename 路径中通过 self.fs.directory_mutation 获取的
filesystem-wide 锁,避免不同目录操作被全局串行化;改用按目录或目录对的锁保护共享状态,或至少将锁定范围缩短至必要的元数据更新,不要覆盖磁盘
I/O、inode 分配/删除及缓存失效流程。同步处理 inode.rs 中其他对应的 directory_mutation 使用点。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c15200bb-5773-42ae-b595-fa6460007ea0
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lockCargo.tomlis excluded by!*.toml
📒 Files selected for processing (58)
.cargo/config.tomlAGENTS.mdMakefilearceos/api/axfeat/Cargo.tomlarceos/modules/axfs/src/fs/ext4/fs.rsarceos/modules/axfs/src/fs/ext4/inode.rsarceos/modules/axhal/src/dummy.rsarceos/modules/axhal/src/irq.rsarceos/modules/axhal/src/lib.rsarceos/modules/axipi/src/lib.rsarceos/modules/axipi/src/queue.rsarceos/modules/axmm/Cargo.tomlarceos/modules/axmm/src/aspace.rsarceos/modules/axmm/src/backend/alloc.rsarceos/modules/axnet/src/smoltcp_impl/mod.rsarceos/modules/axruntime/Cargo.tomlarceos/modules/axruntime/src/lib.rsarceos/modules/axruntime/src/mp.rsarceos/modules/axtask/Cargo.tomlarceos/modules/axtask/src/api.rsarceos/modules/axtask/src/future/mod.rsarceos/modules/axtask/src/run_queue.rsarceos/modules/axtask/src/task.rsarceos/scripts/make/qemu.mkcrates/axplat-loongarch64-qemu-virt/axconfig.tomlcrates/axplat-loongarch64-qemu-virt/src/boot.rscrates/axplat-loongarch64-qemu-virt/src/boot_common.rscrates/axplat-loongarch64-qemu-virt/src/console.rscrates/axplat-loongarch64-qemu-virt/src/irq.rscrates/axplat-loongarch64-qemu-virt/src/irq/eiointc.rscrates/axplat-loongarch64-qemu-virt/src/irq/irq_common.rscrates/axplat-loongarch64-qemu-virt/src/lib.rscrates/axplat-loongarch64-qemu-virt/src/mem.rscrates/axplat-loongarch64-qemu-virt/src/mp.rscrates/axplat-loongarch64-qemu-virt/src/mp_common.rscrates/axplat-loongarch64-qemu-virt/src/power.rscrates/axplat-loongarch64-qemu-virt/src/time.rscrates/axplat-loongarch64-qemu-virt/src/time_common.rscrates/axplat-riscv64-qemu-virt/Cargo.tomlcrates/axplat-riscv64-qemu-virt/axconfig.tomlcrates/axplat-riscv64-qemu-virt/src/boot.rscrates/axplat-riscv64-qemu-virt/src/cpu_topology.rscrates/axplat-riscv64-qemu-virt/src/init.rscrates/axplat-riscv64-qemu-virt/src/irq.rscrates/axplat-riscv64-qemu-virt/src/lib.rscrates/axplat-riscv64-qemu-virt/src/mem.rscrates/axplat-riscv64-qemu-virt/src/plic.rscrates/axplat-riscv64-qemu-virt/src/power.rscrates/axplat-riscv64-qemu-virt/src/topology.rscrates/axplat/src/irq.rscrates/axplat/src/power.rscrates/ext4plus/src/lib.rspulse_core/src/mm/loader.rspulse_core/src/task/mod.rspulse_core/src/task/process.rspulse_core/src/task/thread.rspulse_syscalls/src/handler.rssrc/main.rs
💤 Files with no reviewable changes (1)
- src/main.rs
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pulse_core/src/task/process.rs (1)
2632-2638: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win在分配内存前限制
nr_futexes的最大值以防止 DoS 攻击。没有任何限制地使用用户传入的
nr_futexes调用Vec::with_capacity,若传入极大的值会导致内核分配器因请求过大内存而引发 Panic (OOM),从而产生拒绝服务 (DoS) 漏洞。建议参考 Linux 引入FUTEX_WAITV_MAX(128) 限制,同时拦截nr_futexes == 0的非法请求。🐛 建议的修复
pub fn futex_waitv( &self, waiters_addr: usize, nr_futexes: u32, _flags: u32, timeout_ns: Option<u64>, ) -> AxResult<isize> { + const FUTEX_WAITV_MAX: u32 = 128; + if nr_futexes == 0 || nr_futexes > FUTEX_WAITV_MAX { + return Err(AxError::InvalidInput); + } let mut waiters = alloc::vec::Vec::with_capacity(nr_futexes as usize);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pulse_core/src/task/process.rs` around lines 2632 - 2638, 在包含 Vec::with_capacity 的 futex 等待方法中,先校验用户传入的 nr_futexes:拒绝 nr_futexes == 0 以及超过 128(FUTEX_WAITV_MAX)的请求,并返回该方法约定的无效参数错误;仅在校验通过后分配 waiters,避免过大的容量请求触发 OOM。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@pulse_core/src/task/process.rs`:
- Around line 2632-2638: 在包含 Vec::with_capacity 的 futex 等待方法中,先校验用户传入的
nr_futexes:拒绝 nr_futexes == 0 以及超过
128(FUTEX_WAITV_MAX)的请求,并返回该方法约定的无效参数错误;仅在校验通过后分配 waiters,避免过大的容量请求触发 OOM。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f06679cc-21e2-4050-a9a6-db4b295d894e
📒 Files selected for processing (11)
arceos/modules/axhal/src/dummy.rsarceos/modules/axruntime/src/lib.rsarceos/modules/axruntime/src/mp.rsarceos/scripts/make/qemu.mkcrates/axplat-loongarch64-qemu-virt/src/irq.rscrates/axplat-loongarch64-qemu-virt/src/mem.rscrates/axplat-loongarch64-qemu-virt/src/mp.rscrates/axplat-riscv64-qemu-virt/src/mem.rspulse_core/src/task/process.rspulse_core/src/task/thread.rspulse_syscalls/src/handler.rs
🚧 Files skipped from review as they are similar to previous changes (6)
- pulse_syscalls/src/handler.rs
- crates/axplat-loongarch64-qemu-virt/src/mem.rs
- crates/axplat-loongarch64-qemu-virt/src/mp.rs
- crates/axplat-riscv64-qemu-virt/src/mem.rs
- crates/axplat-loongarch64-qemu-virt/src/irq.rs
- arceos/modules/axruntime/src/lib.rs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pulse_core/src/record_lock.rs`:
- Around line 128-137: 在 do_record_lock 的成功加锁路径中,检测 clear_owner_range
是否实际释放或收窄了原有锁区间;若存在冲突区间已消失,克隆对应 target 的 wait_queue 并调用 notify_all
唤醒等待者。保持无实际范围变化时不发送通知,并保留现有新锁记录写入与成功返回逻辑。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a8b46430-97ce-422d-8cf1-834eb37c310f
📒 Files selected for processing (9)
arceos/modules/axmm/src/aspace.rsarceos/modules/axmm/src/lib.rsarceos/modules/axtask/src/timers.rscrates/axplat-loongarch64-qemu-virt/axconfig.tomlpulse_core/src/lib.rspulse_core/src/mm/loader.rspulse_core/src/record_lock.rspulse_core/src/task/process.rspulse_syscalls/src/impls/fs/fd.rs
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
arceos/modules/axmm/src/aspace.rs (1)
51-87: 🚀 Performance & Scalability | 🔵 TrivialIPI 路径下每次页表变更都会触发全局 TLB flush。
在
ipi特性下,complete_after_unlock忽略asids(let _ = asids;)并调用axipi::flush_tlb_all_cpus(),这是对所有 CPU 的全量 TLB 刷新。由于unmap/protect/remap/COW 缺页(handle_page_fault的HandledWithShootdown)都会走到这里,多线程进程的 COW 缺页热路径会在每次故障时对所有核发起一次全局 shootdown,SMP 下可能成为可扩展性瓶颈。功能上正确,仅作架构提示:后续可考虑提供按 ASID / 按页范围的定向 shootdown 接口,让
TlbShootdown携带的asids在 IPI 路径中真正生效,减少不必要的全量刷新。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@arceos/modules/axmm/src/aspace.rs` around lines 51 - 87, Update TlbShootdown::complete_after_unlock in the IPI path to use the ASIDs carried by asids for targeted TLB shootdowns instead of discarding them via let _ = asids and calling axipi::flush_tlb_all_cpus(). Preserve the existing reclaim and shootdown-error handling while routing invalidation only to the affected address spaces.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@arceos/modules/axmm/src/backend/alloc.rs`:
- Around line 218-223: 修复 alloc.rs 中 pt.unmap 成功后的 page_size.is_huge 分支:返回 false
前先调用 tlb.flush() 并将 frame 交给 reclaim.defer_frame(frame)。同时在 file.rs 的 pt.unmap
流程中,为 page_size != PageSize::Size4K 分支应用相同处理,确保两处均遵守延迟回收契约。
---
Nitpick comments:
In `@arceos/modules/axmm/src/aspace.rs`:
- Around line 51-87: Update TlbShootdown::complete_after_unlock in the IPI path
to use the ASIDs carried by asids for targeted TLB shootdowns instead of
discarding them via let _ = asids and calling axipi::flush_tlb_all_cpus().
Preserve the existing reclaim and shootdown-error handling while routing
invalidation only to the affected address spaces.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 73aa1c84-fe82-4cf1-a2c5-f39c87701c4b
📒 Files selected for processing (16)
arceos/modules/axdma/src/dma.rsarceos/modules/axipi/src/lib.rsarceos/modules/axmm/src/aspace.rsarceos/modules/axmm/src/backend/alloc.rsarceos/modules/axmm/src/backend/cow.rsarceos/modules/axmm/src/backend/file.rsarceos/modules/axmm/src/backend/mod.rsarceos/modules/axmm/src/lib.rscrates/memory_set/README.mdcrates/memory_set/src/area.rscrates/memory_set/src/backend.rscrates/memory_set/src/set.rscrates/memory_set/src/tests.rspulse_core/src/fd_table.rspulse_syscalls/src/impls/ipc/shm.rspulse_syscalls/src/impls/mm.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- arceos/modules/axmm/src/lib.rs
| if let Ok((frame, page_size, tlb)) = pt.unmap(addr) { | ||
| // Deallocate the physical frame if there is a mapping in the | ||
| // page table. | ||
| if page_size.is_huge() { | ||
| return false; | ||
| } | ||
| tlb.flush(); | ||
| if frame.as_usize() != 0 { | ||
| dealloc_frame(frame); | ||
| } | ||
| } else { | ||
| // Deallocation is needn't if the page is not mapped. | ||
| reclaim.defer_frame(frame); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
违反 unmap 延迟回收契约:提前 return false 会泄漏刚解除映射的帧。
crates/memory_set/src/backend.rs(L30-L32)明确要求:从页表分离的资源即使在部分 unmap 后返回 false 也必须加入 reclaim。这两处在遇到非预期页大小时,pt.unmap(addr) 已成功分离了该帧,却在未 defer_frame(也未 tlb.flush)的情况下直接返回 false,导致该物理帧被泄漏。虽然 alloc/file 后端理论上不应出现大页,但仍建议在返回前把已分离的帧交给 reclaim 以遵守契约。
arceos/modules/axmm/src/backend/alloc.rs#L218-L223:在if page_size.is_huge()分支返回false前,先tlb.flush()并reclaim.defer_frame(frame)。arceos/modules/axmm/src/backend/file.rs#L189-L192:在if page_size != PageSize::Size4K分支返回false前,对已分离的frame执行相同的tlb.flush()+reclaim.defer_frame(frame)。
📍 Affects 2 files
arceos/modules/axmm/src/backend/alloc.rs#L218-L223(this comment)arceos/modules/axmm/src/backend/file.rs#L189-L192
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@arceos/modules/axmm/src/backend/alloc.rs` around lines 218 - 223, 修复 alloc.rs
中 pt.unmap 成功后的 page_size.is_huge 分支:返回 false 前先调用 tlb.flush() 并将 frame 交给
reclaim.defer_frame(frame)。同时在 file.rs 的 pt.unmap 流程中,为 page_size !=
PageSize::Size4K 分支应用相同处理,确保两处均遵守延迟回收契约。
Summary by CodeRabbit