Skip to content

Fix up core count detection logic on android#131234

Open
eduardo-vp wants to merge 1 commit into
dotnet:mainfrom
eduardo-vp:fix-android-core
Open

Fix up core count detection logic on android#131234
eduardo-vp wants to merge 1 commit into
dotnet:mainfrom
eduardo-vp:fix-android-core

Conversation

@eduardo-vp

@eduardo-vp eduardo-vp commented Jul 22, 2026

Copy link
Copy Markdown
Member

Parse /sys/devices/system/cpu/present as a comma-separated cpulist (single indices and ranges) rather than assuming a single 0-(n-1) range.

Closes #126417.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @VSadov
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Mono’s Android CPU core-count detection to correctly parse the kernel’s /sys/devices/system/cpu/present “cpulist” format (including non-contiguous ranges), improving the accuracy of mono_cpu_count() on Android.

Changes:

  • Parse /sys/devices/system/cpu/present as a comma-separated cpulist (single indices and ranges) rather than assuming a single 0-(n-1) range.
  • Increase the read buffer size and add parsing success gating so malformed/partial reads fall back to existing platform logic.
  • Clarify the comment describing the /sys entry format with concrete examples.

@jkotas

jkotas commented Jul 22, 2026

Copy link
Copy Markdown
Member

Do we need the same logic for CoreCLR/NAOT on Android?

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.

[android] Test failure: check core count detection logic

3 participants