Skip to content

fix: lock shared region before clearing proc slots in oom_check - #227

Open
mesutoezdil wants to merge 1 commit into
Project-HAMi:mainfrom
mesutoezdil:fix/oom-check-missing-lock
Open

fix: lock shared region before clearing proc slots in oom_check#227
mesutoezdil wants to merge 1 commit into
Project-HAMi:mainfrom
mesutoezdil:fix/oom-check-missing-lock

Conversation

@mesutoezdil

@mesutoezdil mesutoezdil commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

oom_check called clear_proc_slot_nolock without holding the shrreg lock, unlike its other caller. Concurrent OOM across processes can race on the shared proc table. Now it locks around the call, same as init_proc_slot_withlock.

Summary by CodeRabbit

  • Bug Fixes

    • Improved out-of-memory handling during resource allocation to safely retry after clearing an available process slot.
  • Documentation

    • Clarified internal comments related to GPU allocation and resource tracking.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
@hami-robot

hami-robot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mesutoezdil
Once this PR has been reviewed and has the lgtm label, please assign archlitchi for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 14eed1f2-dbd8-4480-a191-e0c87de4156a

📥 Commits

Reviewing files that changed from the base of the PR and between 06e6980 and 57f548d.

📒 Files selected for processing (1)
  • src/allocator/allocator.c

📝 Walkthrough

Walkthrough

The allocator now protects OOM process-slot cleanup with shared-region locking, stores the cleanup result before retrying, and updates two nearby add_chunk comments.

Changes

Allocator OOM synchronization

Layer / File(s) Summary
Protect OOM cleanup with shared-region locking
src/allocator/allocator.c
oom_check wraps process-slot clearing with lock_shrreg() and unlock_shrreg(), uses the result for retry logic, and revises two add_chunk comments.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: archlitchi, chaunceyjiang

Poem

I’m a rabbit guarding slots in the night,
Locking shared regions snug and tight.
OOM hops back for one more try,
While comments wave as chunks pass by.
Carrots cheer the safer flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: locking the shared region before clearing proc slots in oom_check.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hami-robot hami-robot Bot added the size/XS label Jul 22, 2026
@mesutoezdil

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant