ke: scheduler overhaul

This commit is contained in:
Loïc Grégoire
2026-08-19 18:04:12 -04:00
parent f78d10b62e
commit ee0c6aad67
13 changed files with 896 additions and 733 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ pub fn init() void {
console_list.init();
const td = ps.thread.create_kernel(
ke.Thread.Priority.default,
.Default,
worker,
null,
) catch @panic("handle me");
+2 -2
View File
@@ -26,7 +26,7 @@ pub fn init() void {
if (rtl.cmdline.get_string(cline, "test")) |tst| {
// Run a test if specified.
if (r.tests.tests.get(tst)) |func| {
const t = ps.thread.create_kernel(ke.Thread.Priority.default, func, r.boot_info) catch @panic("oom");
const t = ps.thread.create_kernel(.Default, func, r.boot_info) catch @panic("oom");
ke.sched.enqueue(&t.kern);
} else {
std.log.info("invalid test: \"{s}\"", .{tst});
@@ -35,6 +35,6 @@ pub fn init() void {
}
if (r.boot_info.framebuffer != null) {
// fbconsole.init(boot_info);
// fbconsole.init(r.boot_info);
}
}
+7 -5
View File
@@ -50,11 +50,11 @@ pub const WorkItem = struct {
/// High priority work.
High,
pub fn to_sched_prio(prio: Priority) u8 {
pub fn to_sched_prio(prio: Priority) ke.Thread.Priority {
return switch (prio) {
.Low => ke.Thread.Priority.low_batch,
.Normal => ke.Thread.Priority.high_batch,
.High => ke.Thread.Priority.low_realtime,
.Low => .LowBatch,
.Normal => .HighBatch,
.High => .LowRealtime,
};
}
};
@@ -128,6 +128,8 @@ const Pool = struct {
@ptrFromInt(ctx.value),
);
td.kern.nice = -ke.Thread.Priority.nice_max;
if (cpu != null) {
td.kern.last_cpu = cpu;
td.kern.pinned = true;
@@ -312,7 +314,7 @@ pub fn init() !void {
try low.init(.Low, null);
var td = ps.thread.create_kernel(
ke.Thread.Priority.default,
.Default,
pool_manager,
null,
) catch @panic("Failed to create pool manager");