Skip to content

sched_mic: add sched_mic(4) manual page#387

Merged
laffer1 merged 1 commit into
masterfrom
sched_mic-manpage
Jun 12, 2026
Merged

sched_mic: add sched_mic(4) manual page#387
laffer1 merged 1 commit into
masterfrom
sched_mic-manpage

Conversation

@laffer1

@laffer1 laffer1 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

SCHED_MIC was merged (#385) without a manual page, while the other schedulers
ship sched_ule(4) and sched_4bsd(4). This adds sched_mic(4).

  • New share/man/man4/sched_mic.4, modeled on sched_ule.4, documenting the
    four hybrid core priority classes, per-CPU class detection (Intel P/E via
    CPUID, AMD cache/compute dies via L3 size), the soft placement preference, and
    the kern.sched.* tunables: class_weight_eff, class_weight_lp,
    smt_busy_penalty, prefer_compute, detect_lpe, and the read-only
    core_class dump.
  • Wired into share/man/man4/Makefile (alphabetical).
  • Added .Xr sched_mic 4 cross-references to sched_ule.4 and sched_4bsd.4.

Testing

mandoc -Tlint is clean on sched_mic.4. The only lint output for the two
existing pages is the expected referenced manual not found: Xr sched_mic 4
STYLE note, which resolves once the new page is installed.

🤖 Generated with Claude Code

Summary by Sourcery

Add a new manual page documenting the sched_mic(4) hybrid-core-aware scheduler and integrate it with the existing scheduler manpage set.

Documentation:

  • Introduce sched_mic(4) man page describing hybrid-core scheduling behavior, core-class detection, and related kern.sched tunables.
  • Link sched_mic(4) from the sched_4bsd(4) and sched_ule(4) manual pages for cross-referenced scheduler documentation.

SCHED_MIC was added in 8856847 without a manual page, while the other
schedulers ship sched_ule(4) and sched_4bsd(4). Add sched_mic(4),
modeled on sched_ule(4), documenting the four hybrid core priority
classes, the per-CPU class detection, and the kern.sched.* tunables
(class_weight_eff, class_weight_lp, smt_busy_penalty, prefer_compute,
detect_lpe, and the read-only core_class dump).

Wire it into share/man/man4/Makefile and add cross-references from
sched_ule(4) and sched_4bsd(4).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new sched_mic(4) manual page documenting the hybrid-core-aware scheduler, wires it into the man4 Makefile, and updates existing scheduler man pages to cross-reference it.

Flow diagram for sched_mic(4) hybrid core placement logic

flowchart TD
    A[Thread ready to run] --> B[Scheduler sched_mic selects CPU]
    B --> C[Detect CPU core_class via CPUID or L3 size]
    C --> D{Core class}
    D -->|class 1 performance| E[Apply base load]
    D -->|class 2 efficiency| F[Apply class_weight_eff penalty]
    D -->|class 4 low power| G[Apply class_weight_lp penalty]
    D -->|SMT sibling busy| H[Apply smt_busy_penalty]

    F --> I[Compute effective load per CPU]
    G --> I
    E --> I
    H --> I

    I --> J{AMD hybrid CCD?}
    J -->|yes & prefer_compute=0| K[Prefer 3D V-Cache CCD]
    J -->|yes & prefer_compute=1| L[Prefer compute CCD]
    J -->|no| M[No CCD preference]

    K --> N[Choose CPU with lowest effective load]
    L --> N
    M --> N

    N --> O[Run thread on selected CPU]

    subgraph Sysctls influencing placement
        F -. controlled by .-> S1[kern.sched.class_weight_eff]
        G -. controlled by .-> S2[kern.sched.class_weight_lp]
        H -. controlled by .-> S3[kern.sched.smt_busy_penalty]
        K -. controlled by .-> S4[kern.sched.prefer_compute]
    end
Loading

File-Level Changes

Change Details Files
Add sched_mic(4) manual page describing the hybrid-core-aware scheduler and its tunables.
  • Introduce new man page modeled after sched_ule(4) with description of hybrid-core behavior and fallback to sched_ule semantics on non-hybrid or non-x86 systems.
  • Document core-class detection logic for Intel (CPUID hybrid leaf) and AMD (per-die L3 size) architectures and how unrecognized hardware is treated.
  • Describe hybrid placement behavior including core priority ordering (performance, efficiency, SMT sibling, LP-E) and interaction with load balancing.
  • Detail additional kern.sched sysctls (class_weight_eff, class_weight_lp, smt_busy_penalty, prefer_compute, detect_lpe, core_class) and their effects on scheduling decisions.
  • Add history and authorship sections for the new scheduler man page.
share/man/man4/sched_mic.4
Wire sched_mic(4) into existing documentation build and cross-references.
  • Add sched_mic.4 to the man4 Makefile MAN list in alphabetical order so it is built and installed with other man pages.
  • Add .Xr sched_mic 4 cross-reference to sched_ule(4) where advanced schedulers are mentioned and in its SEE ALSO section.
  • Add .Xr sched_mic 4 cross-reference to sched_4bsd(4) SEE ALSO section.
share/man/man4/Makefile
share/man/man4/sched_ule.4
share/man/man4/sched_4bsd.4

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds the man page for the new hybrid-core-aware scheduler, sched_mic.4, and updates the Makefile and other scheduler man pages with cross-references. Feedback suggests removing the reference to sched_mic in the description of sched_ule.4, as sched_mic is derived from sched_ule and inherits its features, and including it there breaks the sentence structure.

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.

Comment on lines 39 to +40
.Xr sched_4bsd 4 ,
.Xr sched_mic 4 ,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The sched_ule scheduler does not provide features that are missing from sched_mic. In fact, sched_mic is derived from sched_ule and inherits all of its features. Additionally, listing sched_mic here breaks the grammar of the sentence, as "the traditional system scheduler" only refers to sched_4bsd. This cross-reference should be removed from this sentence (it is already correctly placed in the SEE ALSO section).

.Xr sched_4bsd 4 ,

@laffer1 laffer1 merged commit 2999bb6 into master Jun 12, 2026
6 of 12 checks passed
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

Claude finished @laffer1's task —— View job


Code Review for PR #387: sched_mic(4) Manual Page

Reviewing the merged PR for correctness, style(9) compliance, and technical accuracy.

Todo List:

  • Read and analyze all changed files
  • Review manual page content for technical accuracy
  • Check style(9) compliance (8-space tabs, 80-column limit)
  • Evaluate cross-reference placement issue
  • Provide review feedback

Review Findings:

Style Compliance: ✅ PASS

  • Maximum line length: 78 characters (within 80-column limit)
  • Standard manual page formatting follows BSD conventions
  • Proper use of mdoc macros

Technical Accuracy: ✅ GOOD

  • Manual page content accurately describes sched_mic functionality
  • Sysctls are properly documented with correct variable names
  • Core class detection logic clearly explained
  • Hybrid core priority ordering correctly documented

Critical Issue: Cross-Reference Placement

  • sched_ule.4:40 - The gemini-code-assist review identified a significant grammatical issue. The sentence "provides a number of advanced scheduler features not present in .Xr sched_4bsd 4, .Xr sched_mic 4, the traditional system scheduler" is incorrect because:
    1. sched_mic is derived from sched_ule and inherits its features, so listing it as lacking features is factually wrong
    2. "the traditional system scheduler" refers only to sched_4bsd, making the grammar incorrect
    3. The cross-reference is already properly placed in the SEE ALSO section

Recommendation:
Remove .Xr sched_mic 4 , from line 40 in sched_ule.4. The cross-reference should remain only in the SEE ALSO section where it's grammatically and contextually appropriate.

Other Changes: ✅ GOOD

  • Makefile addition is correctly placed alphabetically
  • sched_4bsd.4 cross-reference addition is appropriate
  • New manual page follows established patterns from existing scheduler documentation

Security/Safety: ✅ N/A

  • Documentation-only changes, no code security concerns
  • No assembly or contrib/mksh changes (AI review restrictions don't apply)

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The .Dd date in sched_mic.4 is set to June 11, 2026, which looks like a future/typo date relative to this change and should be updated to the actual commit date.
  • In the HISTORY section, Mx 4.0 is ambiguous and likely a placeholder or typo; consider replacing it with the correct OS name and release where sched_mic actually first appears.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `.Dd` date in `sched_mic.4` is set to June 11, 2026, which looks like a future/typo date relative to this change and should be updated to the actual commit date.
- In the HISTORY section, `Mx 4.0` is ambiguous and likely a placeholder or typo; consider replacing it with the correct OS name and release where `sched_mic` actually first appears.

## Individual Comments

### Comment 1
<location path="share/man/man4/sched_mic.4" line_range="41-42" />
<code_context>
+and retains all of its behavior, adding awareness of heterogeneous
+.Pq Dq hybrid
+CPU cores on x86 systems.
+On processors that mix fast and efficient cores it weighs four core
+priority classes when placing a thread, preferring, in order:
+.Pp
+.Bl -enum -compact -offset indent
+.It
+performance cores
+.Pq Intel P-cores, AMD 3D V-Cache CCD cores ;
+.It
+efficiency cores
+.Pq Intel E-cores, AMD compute-CCD cores, AMD mobile \(dqC\(dq cores ;
+.It
+the second SMT thread of an already busy core; and
+.It
+Intel low-power
+.Pq LP-E
+cores, which are used last.
</code_context>
<issue_to_address>
**suggestion (typo):** Clarify the "four core priority classes" wording to better match the described items

The list mixes three core classes with one SMT occupancy condition. Consider rephrasing to something like “it weighs core classes and SMT occupancy when placing a thread” so the terminology aligns with what’s actually being prioritized and doesn’t imply four distinct core classes.

```suggestion
On processors that mix fast and efficient cores it weighs core classes
and SMT occupancy when placing a thread, preferring, in order:
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +41 to +42
On processors that mix fast and efficient cores it weighs four core
priority classes when placing a thread, preferring, in order:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (typo): Clarify the "four core priority classes" wording to better match the described items

The list mixes three core classes with one SMT occupancy condition. Consider rephrasing to something like “it weighs core classes and SMT occupancy when placing a thread” so the terminology aligns with what’s actually being prioritized and doesn’t imply four distinct core classes.

Suggested change
On processors that mix fast and efficient cores it weighs four core
priority classes when placing a thread, preferring, in order:
On processors that mix fast and efficient cores it weighs core classes
and SMT occupancy when placing a thread, preferring, in order:

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.

1 participant