fix(mm/oom): staged OOM killer fixes — victim marking, direct reclaim, observability#1995
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff53205ed7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
fslongjin
left a comment
There was a problem hiding this comment.
基于本地对 PR1995 的多 subagent 对抗性审查,下面是已结合 DragonOS 与 Linux 6.6.139 源码核实后的 inline comments。
0c2d636 to
38f0487
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38f0487438
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…, observability Phase 1 (bug fixes + observability): - Fix wait_until_recoverable generation guard dead code (Some(_) => true) - Add OOM kill counter (OOM_KILL_COUNT atomic) wired to /proc/vmstat oom_kill - Add /proc/[pid]/oom_score read-only file (normalized [0,1000]) - Fix hardcoded order:1 → order:0 in pagefault OOM context Phase 2 (victim forward-progress guarantee, prevents OOM livelock): - Add ProcessFlags::OOM_VICTIM (equivalent to Linux TIF_MEMDIE) - Mark all tasks sharing victim mm with OOM_VICTIM before SIGKILL delivery - Clear OOM_VICTIM in exit path via exit_oom_victim() - Skip already-marked victims in should_skip_candidate() Phase 3 (direct reclaim before kill): - Insert PageReclaimer::shrink_list(64) before pagefault_out_of_memory() (matching Linux try_to_free_pages before out_of_memory) - Use tried_direct_reclaim flag to bound to one reclaim attempt per fault Test: - Add test_proc_oom_score and test_vmstat_oom_kill_counter to user/apps/c_unitest/test_oom_killer.c Verified: nix develop -c make kernel + make fmt (cargo fmt + clippy) pass. Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
P1: Wire OOM_VICTIM into page-frame allocator (oom.rs:343 / page_frame.rs:349) - allocate_page_frames now retries up to 1000 times when the current task is an OOM victim, preventing livelock when the victim is stuck in an uninterruptible allocation during exit. - Also wakes the page reclaim thread to accelerate memory availability. - This eliminates the previous dead_code warning on current_is_oom_victim. P2: Skip direct reclaim for fault-injection OOM (fault.rs:521 / oom.rs:349) - Add is_fault_inject_target() to check if current task matches the oom_fault_inject config. - When true, skip the shrink_list(64) direct-reclaim step so the injection is consumed by the killer path rather than a reclaim-then-retry cycle. - Without this, fail_times=1 injections were consumed by reclaim, causing test_current_is_victim and test_vmstat_oom_kill_counter to fail. Verified: make kernel + make fmt (cargo fmt + clippy) pass, zero warnings. Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
…GENTS.md - Add Nix develop/yolo command pointer to '常见命令' section - Add WHERE TO LOOK table with 3 non-intuitive paths: - Running DragonOS -> docs/introduction/develop_nix.md - OOM Killer -> kernel/src/mm/oom.rs - Post-refactor process management -> state.rs / exit.rs (mod.rs split in DragonOS-Community#1993) Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
38f0487 to
225610f
Compare
|
@codex review |
Signed-off-by: longjin <longjin@dragonos.org>
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Phase 1 (bug fixes + observability):
Phase 2 (victim forward-progress guarantee, prevents OOM livelock):
Phase 3 (direct reclaim before kill):
Test:
Verified: nix develop -c make kernel + make fmt (cargo fmt + clippy) pass.
ref #1976