PrioritizedRR: `invoke_preemption_tick()` pops and re-queues a lower-priority queue head on every primary loop iteration
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- operating-systems
Direzione di ricerca
Start in awkernel_async_lib/src/scheduler/prioritized_rr.rs at invoke_preemption_tick() and trace how get_next_task(false) feeds push_preemption_pending and the IPI. Then read preempt.rs do_preemption() to see where a lower-priority pending task is re-queued through wake_task, and check the peek support in PriorityQueue and AffinityBTreeQueue. Done means the tick peeks before popping, skips lower-priority rotation, and refreshes last_executed_time when it does not preempt.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
PrioritizedRR: invoke_preemption_tick() pops and re-queues a lower-priority queue head on every primary loop iteration
Summary
PrioritizedRRScheduler::invoke_preemption_tick()
(awkernel_async_lib/src/scheduler/prioritized_rr.rs) decides to rotate a running
PrioritizedRR task only by elapsed time. When the quantum (4 ms) has expired it calls
get_next_task(false), which removes the highest-priority runnable task from the
run queues, pushes it to the target CPU's preemption-pending heap and sends an IPI,
without comparing its priority with the running task.
If that task has a lower priority than the running one (e.g. the CPU runs RR(1) and
the queue head is RR(0)), do_preemption() on the target CPU does not preempt and
re-queues the task through Scheduler::wake_task, which appends it to the tail of
its priority level. Nothing refreshes last_executed_time (it is updated only on
dispatch in run_main/yield_and_pool), so on the next primary loop iteration the
quantum is still "expired" and the whole sequence repeats with the new queue head.
Flow
kernel/src/main.rsprimary loop →scheduler::wake_task()→ for every worker CPU
running a PrioritizedRR task:invoke_preemption_tick(cpu_id, task_id). Without a
timer the primary loop spins withwait_microsec(10), so this fires continuously.invoke_preemption_tick():elapsed > interval→get_next_task(false)pops the
queue head →push_preemption_pending→set_need_preemption→send_ipi.preempt.rsdo_preemption(): the pending task has a strictly lower priority than
the running task →remove_preemption_pending+next.scheduler.wake_task(next),
i.e. back into the run queue at the tail of its level.last_executed_timeunchanged → step 2 again on the next iteration.
Consequences
- One IPI per RR-running CPU per primary loop iteration, for as long as the queue head
has a lower priority than every running RR task. - The lower-priority FIFO level is rotated by one task on every tick, so FIFO order
within that level is not preserved: when a CPU becomes free, the task that runs is
whichever one happens to be at the head, not the one that waited longest. - Each round moves the task run queue → pending heap → run queue, with the
corresponding counter updates and lock acquisitions.
This predates #725: the old check current_task > next re-queued a lower-priority
next in the same way. #725 only removed the equal-priority case (which is now the
intended quantum rotation).
Fix
- In
invoke_preemption_tick(), peek at the best runnable task before popping and
only pop/send the IPI if its priority is at least that of the running task. This
needs a peek counterpart ofget_next_task(false)across the schedulers (the
PriorityQueueandAffinityBTreeQueueboth support peeking). - When the tick decides not to rotate, refresh the quantum origin
(last_executed_time) so the tick does not fire again on the next iteration.
- Lingua principale
- Rust
- Stelle
- 282
- Fork
- 12
- Merge medio
- 2g 9h
- PR unite (30g)
- 28
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tier4/awkernel
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 2 giorni
-
Deadlock in ixgbeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di tier4/awkernel
Issue simili
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
flashbots/panetiere#46 · 1 commento ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jlcodes99/cockpit-tools#3190 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Feyisara2108/stellargive#1376 ·
I maintainer di solito rispondono entro 1 giorno
-
area:post bug effort:medium P7 source:agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno