daily-tech:2026-12-02 現象: 延續上一篇我們討論 Linux OOM Killer 與記憶體壓力時看到的系統雪崩問題,其實在網路邊緣閘道或高併發 API 主機上,還有一種非常常見的「還沒進應用程式就先卡死」情境。假設你的 Linux 伺服器突然遭遇大量異常 UDP 或 TCP SYN 封包洪水,你立刻在 nftables 或 iptables 的 PREROUTING 鏈加上丟棄規則,卻發現 top 畫面裡的軟中斷(SoftIRQ, %si )與 ksoftirqd 核心執行緒依然飆高,正常的 SSH 連線和 API 請求開始出現明顯延遲。明明防火牆已經把惡意封包全數 DROP 了,為什麼 CPU 和核心記憶體仍然喘不過氣? Symptom: Continuing from our previous breakdown of Linux OOM Killer and memory pressure, edge gateways and high-concurrency API servers often hit another frustrating wall where the machine stalls before user-space code even runs. Suppose your Linux host is hit by a flood of malformed UDP or TCP SYN packets: you add a DROP rule in the nftables or iptables PREROUTING chain, yet top still shows SoftIRQ ( %si ) and ksoftirqd spiking while legitimate SSH and API traffic slows to a crawl. If the firewall is already dropping those packets, why are CPU cycles and kernel memory still getting crushed? 答案不在防火牆規則寫得不夠早,而在於 Linux 傳統網路協定堆疊「太早把封包包裝成重型物件」 。只要一...
Linux 核心 OOM Killer 與 Android LMKd 協同機制深度拆解:從 oom_badness 評分算法到端側 LLM 記憶體防禦實戰 / Deconstructing Linux Kernel OOM Killer and Android LMKd Orchestration: From oom_badness Scoring Algorithm to Edge LLM Memory Defense in Practice
daily-tech:2026-11-30 Linux 核心 OOM Killer 與 Android LMKd 協同機制深度拆解:從 oom_badness 評分算法到端側 LLM 記憶體防禦實戰 / Deconstructing Linux Kernel OOM Killer and Android LMKd Orchestration: From oom_badness Scoring Algorithm to Edge LLM Memory Defense in Practice 現象: 在現代旗艦 Android 智慧型手機、智慧車載系統與邊緣運算(Edge AI)硬體上,部署 2B 至 7B 參數規模的端側大語言模型(On-Device LLM,如 Gemma 2、Llama 3 或 Qwen 2.5)已經成為可能。然而,許多軟體團隊在實機壓測時常遭遇令人費解的崩潰現象:當模型剛載入時運作正常,但在長對話或使用者輸入複雜多輪提示時,模型吐字進行到第 2,000 個 Token 左右,整個應用程式突然毫無預警閃退;嚴重時,甚至整個系統 UI 出現長達數秒的凍結(System Freezing),隨後桌面啟動器(Launcher)重新加載,終端日誌中僅留下怵目驚心的 Out of memory: Kill process or sacrifice child 訊息。為什麼明明設備具備 8GB 甚至 12GB 實體 LPDDR 記憶體,系統卻依然會慘遭「爆記憶體」?當實體記憶體耗盡時,Linux 核心底層的 OOM Killer 究竟是依據什麼規則決定要殺死哪一個行程?而 Android 的低記憶體守護行程(LMKd)又是如何與 Linux 核心協同作戰,避免系統在端側 AI 狂暴的記憶體消耗下直接崩潰? Symptom: On modern Android flagship smartphones, automotive cockpits, and edge computing platforms, deploying 2B to 7B parameter on-device Large Language Models (LLMs)—such as Gemma 2, Llama 3, or Qwen 2.5—has become feasible. Ho...