build: switch to zonfig

This commit is contained in:
Loïc Grégoire
2026-04-24 10:35:53 -04:00
parent 36690a8149
commit a46782adca
18 changed files with 179 additions and 247 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ pub fn ExportedCpuLocal(comptime T: type, comptime init: T, comptime name: []con
/// Bitmask of CPUs.
pub const CpuMask = struct {
const bits_per_word = @bitSizeOf(usize);
const num_words = (config.CONFIG_NCPUS + bits_per_word - 1) / bits_per_word;
const num_words = (config.ncpus + bits_per_word - 1) / bits_per_word;
bits: [num_words]usize,
+2 -2
View File
@@ -110,13 +110,13 @@ fn dispatch_queue(cpu: u32) void {
}
if (sched_cpu.start_timer) {
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.CONFIG_SCHED_TIMESLICE, &sched_cpu.resched_dpc);
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.sched_timeslice, &sched_cpu.resched_dpc);
}
if (sched_cpu.preemption_reason == .HigherPriority) {
// Reload the quantum for the new thread.
ke.timer.cancel(&sched_cpu.resched_timer);
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.CONFIG_SCHED_TIMESLICE, &sched_cpu.resched_dpc);
ke.timer.set(&sched_cpu.resched_timer, std.time.ns_per_ms * config.sched_timeslice, &sched_cpu.resched_dpc);
}
sched_cpu.start_timer = false;
+1 -1
View File
@@ -37,7 +37,7 @@ const DebugWriter = struct {
// Messages are on average 2^5 = 32 bytes.
const avg_msg_size_bits = 5;
pub var ringbuffer = ki.log_ring.RingBuffer(config.CONFIG_LOG_BUFFER_SHIFT, avg_msg_size_bits).init();
pub var ringbuffer = ki.log_ring.RingBuffer(config.log_buffer_shift, avg_msg_size_bits).init();
pub fn log(
comptime level: std.log.Level,
+5 -6
View File
@@ -3,12 +3,11 @@ const config = @import("config");
const init_mod = @import("init.zig");
pub const impl = if (@hasDecl(config, "CONFIG_ARCH_AMD64"))
@import("amd64/impl.zig")
else if (@hasDecl(config, "CONFIG_ARCH_UM"))
@import("um/impl.zig")
else
@compileError("unsupported architecture");
pub const impl = switch (config.arch) {
.amd64 => @import("amd64/impl.zig"),
.um => @import("um/impl.zig"),
else => @compileError("unsupported architecture"),
};
pub const init = init_mod.init;
+3 -3
View File
@@ -96,7 +96,7 @@ const runqueues_n = 64;
const interactivity_threshold = 30;
const scaling_factor = 50;
const preempt_threshold = ke.Thread.Priority.realtime;
const balance_interval = @as(u64, config.CONFIG_BALANCE_INTERVAL);
const balance_interval = @as(u64, config.sched_balance_interval);
const steal_threshold = 1;
var balance_timer: ke.Timer = undefined;
@@ -211,7 +211,7 @@ pub fn clock(_: ?*anyopaque) void {
if (curtd.priority_class == .Batch) {
// Update interactivity metrics.
curtd.run_time += config.CONFIG_SCHED_TIMESLICE;
curtd.run_time += config.sched_timeslice;
clamp_time(curtd);
recompute_priority(curtd);
@@ -261,7 +261,7 @@ pub fn unblock(td: *ke.Thread) void {
td.sleep_time = (ke.time.read_time() - td.sleep_start) / std.time.ns_per_ms;
if (td.sleep_time >= config.CONFIG_SCHED_TIMESLICE and td.priority_class == .Batch) {
if (td.sleep_time >= config.sched_timeslice and td.priority_class == .Batch) {
// If we have slept for more than a tick, update interactivity.
clamp_time(td);
recompute_priority(td);