Repository navigation
sched: unify RFLAGS definitions and make steal scan limits configurable - #115
Merged
Merged
Conversation
Add include/arch/cpu/eflags.h with the architectural RFLAGS bits and use it to replace the raw 1ULL << 9 tests in the scheduler and APIC code, the 0x202 initial context flags in the scheduler, ELF loader, kthread and syscall paths, and the SYSCALL FMASK value. The signal-return mask now spells out its user-visible flags, and syscall.c drops its local X86_EFLAGS_AC definition in favour of the shared one. No functional change. Signed-off-by: MicroFish <[email protected]>
Replace the hard-coded eight-hot-candidate and 32-node bounds in pick_steal_candidate_locked() with CONFIG_SCHED_STEAL_HOT_BUDGET and CONFIG_SCHED_STEAL_SCAN_LIMIT. The defaults keep the existing policy and the scan visits the same nodes: pinned entities do not spend the hot budget, and a non-newly-idle scan abandons the source once the budget is exhausted. Move the hot-budget check inside the loop so a zero budget is meaningful: cold candidates remain eligible and the scan stops at the first hot one, instead of skipping the loop entirely (which also disabled newly-idle stealing). Add a compile-time check that the hot budget does not exceed the scan limit, and wire both options through Kconfig, the fallback config, kconfig.mk and the default configuration. While validating the zero setting, fix the pre-existing build failure for CONFIG_SCHED_MIGRATION_COOLDOWN=0: copy the cooldown into a local before the unsigned comparison so -Wtype-limits does not reject the always-false case. A zero cooldown still means no cooldown. Validation: GCC LTO build, clang-tidy on kernel/sched/sched.c and clang-format; steal configs 0, 1/1 and 64/64 compile, as does cooldown=0; 64/16 is rejected by the static assert. Signed-off-by: MicroFish <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This series contains two independent cleanups:
x86: unify RFLAGS bit definitions — add
include/arch/cpu/eflags.hand replace the raw RFLAGS constants (1ULL << 9,0x202,0x200, and the localX86_EFLAGS_AC) across the scheduler, APIC, ELF loader, kthread, signal and syscall code. No functional change.sched: make steal scan limits configurable — replace the hard-coded hot-candidate budget (8) and scan-node limit (32) in
pick_steal_candidate_locked()withCONFIG_SCHED_STEAL_HOT_BUDGETandCONFIG_SCHED_STEAL_SCAN_LIMIT. The defaults preserve the current policy and visit the same nodes.The second commit also makes
CONFIG_SCHED_STEAL_HOT_BUDGET=0meaningful: cold candidates and newly-idle stealing remain active, and the scan stops at the first hot candidate. It also fixes a pre-existing-Wtype-limitsbuild failure whenCONFIG_SCHED_MIGRATION_COOLDOWN=0.Validation
make -j4with GCC/LTO and-Wall -Wextra -Werrorclang-tidy kernel/sched/sched.cclang-format --dry-run --Werror0,1/1,64/64, and cooldown0;64/16is rejected by the new static assert.