跳到主要內容

發表文章

目前顯示的是有「EEVDF」標籤的文章

從 EEVDF 看 Linux 核心對端側 AI 延遲敏感度的排程配額優化 / Optimizing Edge AI Latency via Linux EEVDF: Scheduling Quotas and Virtual Deadlines

daily-tech:2026-11-26 從 EEVDF 看 Linux 核心對端側 AI 延遲敏感度的排程配額優化 / Optimizing Edge AI Latency via Linux EEVDF: Scheduling Quotas and Virtual Deadlines 現象: 在 Linux 與 Android 邊緣裝置上部屬端側 AI(例如即時語音辨識、手勢追蹤或端側小型語言模型 SLM Token 生成)時,許多開發團隊在處理高負載背景任務時,常發現 AI 推論會出現不可預期的延遲抖動(Latency Jitter)。即便系統已經透過前篇討論的 DMA-BUF 零拷貝技術消除了大部分的記憶體搬移開銷,但當 AI 執行緒被硬體中斷(如相機新圖框就緒、麥克風音訊緩衝區填滿)喚醒時,往往無法第一時間搶佔 CPU 核心,而是在就緒佇列(Runqueue)中痛苦排隊 5 到 15 毫秒。這類延遲使得即時互動系統的影音同步失效,嚴重傷害端側 AI 的流暢體驗。 Symptom: When deploying on-device AI workloads (such as real-time keyword spotting, gesture tracking, or edge small language model SLM token streaming) on Linux and Android devices under concurrent system loads, developers frequently encounter severe latency jitter. Even after eliminating redundant memory copies using the DMA-BUF zero-copy pipeline analyzed in our previous article, AI threads awakened by hardware interrupts (e.g., camera frame completions or audio buffer fills) often fail to seize CPU cores immediately. Instead, they languish in run...

Linux EEVDF 排程:為什麼低延遲不等於永遠優先 / Linux EEVDF Scheduling: Why Low Latency Does Not Mean Always First

Linux EEVDF 排程:為什麼低延遲不等於永遠優先 / Linux EEVDF Scheduling: Why Low Latency Does Not Mean Always First 現象: 同一台 Linux 主機上,終端機輸入偶爾卡頓,AI 推論或編譯工作卻沒有停止。很多人第一個反應是把互動程式設成「最高優先權」,但這可能只是把延遲轉移給別的工作。Linux 近年的公平排程路徑使用 EEVDF(Earliest Eligible Virtual Deadline First)整理可執行工作:它不是承諾某個程式永遠先跑,而是在公平性與回應時間之間計算下一個選擇。 Symptom: On the same Linux host, terminal input can feel sticky while an AI inference or build continues to run. The first reaction is often to give the interactive task the highest priority, but that may only move the latency elsewhere. Recent Linux fair-scheduling work uses EEVDF, or Earliest Eligible Virtual Deadline First, to order runnable tasks. It does not promise that one program always runs first; it computes a next choice between fairness and responsiveness. 圖一|EEVDF 先判斷工作是否 eligible,再比較虛擬截止時間。 / Figure 1 | EEVDF checks eligibility before comparing virtual deadlines. 機制:先理解 eligible,再談 deadline / Mechanism: Eligibility Comes Before the Deadline 公平排程器不只看「誰等最久」。每個工作會在虛擬執行時間軸上累積進度,並依...

【Linux 排程機制】從 CFS 到 EEVDF:虛擬截止時間如何給 Linux 排程帶來延遲保證 / [Linux Scheduling] From CFS to EEVDF: How Earliest Eligible Virtual Deadline First Brings Latency Guarantees to Linux

你有沒有遇過這種情況:開著幾個重度應用,滑鼠游標明明沒動,系統卻突然停頓半秒,播放的影片掉幀、遊戲瞬間卡住?這往往不是記憶體不足,而是「排程延遲」——核心決定哪個進程下次使用 CPU 的時間點,沒有給即時工作負載足夠的保證。舊版 Linux 預設排程器 CFS(完全公平排程)追求整體公平,但對「這個任務必須在多久內執行」的延遲上限,缺乏明確承諾。 Have you ever experienced this: several heavy applications running, the mouse cursor sits still, yet the system suddenly freezes for half a second, video stutters, or a game hitches? This is often not memory exhaustion, but "scheduling latency" — the kernel's decision of which process gets the CPU next fails to guarantee timing for latency-sensitive workloads. The default Linux scheduler CFS (Completely Fair Scheduler) pursues overall fairness, but lacks a clear upper-bound commitment on "this task must run within how long." struct sched_entity (排程實體) Linux 6.18.55 · kernel/sched/fair.c · include/linux/sched.h EEVDF 決策欄位 load struct load_weight — 加權負載,決定分攤時間比例 run_node struct rb_node — 掛在 CFS 紅黑樹 tasks_timeline 上的節點 vrun...