Skip to content

fix: correct Linux sysfs path for physical core detection - #2186

Merged
leejet merged 1 commit into
leejet:masterfrom
boriselec:boriselec/1
Oct 22, 2026
Merged

leejet merged 1 commit into
leejet:masterfrom
boriselec:boriselec/1

Conversation

@boriselec

@boriselec boriselec commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixed Linux sysfs path for physical core detection.
Currently it is broken and defaults to the half of cores.

Related Issue / Discussion

Function was copied from llama.cpp.
Same bug was fixed in:
ggml-org/llama.cpp#7064

Additional Information

Verified on Linux, 8 CPU, 1 thread per core.

before: 4
after: 8

Checklist

Summary by CodeRabbit

  • Bug Fixes
    • Improved physical CPU core detection on Linux by using the correct system topology information. This can help applications report physical core counts more accurately on supported systems.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7530dd82-a068-4be9-b83d-ffdd9883d2f4
📥 Commits

Reviewing files that changed from the base of the PR and between a77d362 and 09be1a0.

📒 Files selected for processing: 1
  • src/core/util.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The Linux physical-core lookup now reads thread-sibling topology data from /sys/devices/system/cpu/cpuN/topology/thread_siblings. Enumeration and fallback behavior remain unchanged.

Changes: Linux CPU topology lookup

Layer / File(s) Summary
Correct the topology path
src/core/util.cpp
The core-count lookup now includes the /cpu directory component in the sysfs path. Enumeration and fallback behavior are unchanged.

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: leejet

Merge Risk: ⚪ Minimal · up to 09be1

The Linux physical-core lookup now uses the CPU-specific topology path. No merge-blocking issue was identified.

Architecture risk: 🔵 Low · up to 09be1

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in src/core/util.cpp: The Linux core-count lookup now uses the /sys/devices/system/cpu/cpuN/topology/thread_siblings path; previously it omitted the /cpu directory component.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the Linux sysfs path correction for physical core detection.
Description check Passed The description includes the required Summary, Related Issue / Discussion, Additional Information, and Checklist sections. It explains the defect, references the related fix, and provides Linux verifi…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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.
Full details: Description check

Explanation

The description includes the required Summary, Related Issue / Discussion, Additional Information, and Checklist sections. It explains the defect, references the related fix, and provides Linux verification results.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@leejet
leejet merged commit ddd6b3a into leejet:master Oct 22, 2026
2 checks passed
@boriselec
boriselec deleted the boriselec/1 branch October 22, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants