summaryrefslogtreecommitdiff
path: root/kernel/sched_class_o1.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-10-16 02:39:56 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-10-16 02:39:56 +0800
commit8cace3f05003c6cb4d38c36890055f03151c2ad4 (patch)
treeaa739deaac0266f17c4e91b333957501cb1ea2e9 /kernel/sched_class_o1.cc
parent3ad39e9878310e5317ee73c9b353c1e2c1c5c4ee (diff)
downloadlume-8cace3f05003c6cb4d38c36890055f03151c2ad4.tar.gz
lume-8cace3f05003c6cb4d38c36890055f03151c2ad4.tar.xz
Remove old code
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'kernel/sched_class_o1.cc')
-rw-r--r--kernel/sched_class_o1.cc81
1 files changed, 0 insertions, 81 deletions
diff --git a/kernel/sched_class_o1.cc b/kernel/sched_class_o1.cc
deleted file mode 100644
index 28c693c..0000000
--- a/kernel/sched_class_o1.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* Copyright (C) 2026 Richard Qin */
-
-/*
- * O(1) Priority Bitmap Scheduling Class
- */
-
-#include <lume/sched.h>
-#include <lume/sched_class.h>
-#include <lume/task.h>
-#include <lume/bitops.h>
-#include <kernel/sched_internal.h>
-
-static void o1_init_rq(RunQueue* rq)
-{
- rq->o1().init();
-}
-
-static void o1_enqueue_task(RunQueue* rq, TaskControlBlock* task)
-{
- rq->o1().enqueue(task);
- rq->inc_running();
-}
-
-static void o1_dequeue_task(RunQueue* rq, TaskControlBlock* task)
-{
- rq->o1().dequeue(task);
- rq->dec_running();
-}
-
-static TaskControlBlock* o1_pick_next_task(RunQueue* rq)
-{
- return rq->o1().pick_next();
-}
-
-static void o1_put_prev_task(RunQueue* /*rq*/, TaskControlBlock* /*task*/) {}
-
-int32 priority_to_timeslice(uint8 priority)
-{
- int32 ts = 20 - static_cast<int32>(priority) * 19 / 31;
- if (ts < 1) ts = 1;
- return ts;
-}
-
-static void o1_task_tick(RunQueue* rq, TaskControlBlock* curr)
-{
- if (curr == rq->idle()) {
- /* Idle task: if anything is runnable, yield immediately */
- if (rq->nr_running() > 0) {
- rq->set_need_resched(true);
- }
- return;
- }
-
- curr->time_slice--;
- if (curr->time_slice <= 0) {
- curr->time_slice = priority_to_timeslice(curr->priority);
- rq->set_need_resched(true);
- }
-}
-
-static void o1_yield_task(RunQueue* rq, TaskControlBlock* curr)
-{
- if (curr == rq->idle())
- return;
-
- curr->time_slice = 0;
- rq->set_need_resched(true);
-}
-
-const SchedClass g_sched_class_o1 = {
- .name = "o1",
- .next = &g_sched_class_idle,
- .init_rq = o1_init_rq,
- .enqueue_task = o1_enqueue_task,
- .dequeue_task = o1_dequeue_task,
- .pick_next_task = o1_pick_next_task,
- .put_prev_task = o1_put_prev_task,
- .task_tick = o1_task_tick,
- .yield_task = o1_yield_task,
-};