惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
D
Docker
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
Project Zero
Project Zero
Engineering at Meta
Engineering at Meta
J
Java Code Geeks
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Simon Willison's Weblog
Simon Willison's Weblog
S
Security Affairs
NISL@THU
NISL@THU
T
Tor Project blog
A
About on SuperTechFans
宝玉的分享
宝玉的分享
腾讯CDC
S
Schneier on Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
P
Privacy International News Feed
雷峰网
雷峰网
C
Cyber Attacks, Cyber Crime and Cyber Security
Vercel News
Vercel News
Cisco Talos Blog
Cisco Talos Blog
D
DataBreaches.Net
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
L
LINUX DO - 热门话题
Microsoft Security Blog
Microsoft Security Blog
Latest news
Latest news
C
Check Point Blog
有赞技术团队
有赞技术团队
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
Application and Cybersecurity Blog
Application and Cybersecurity Blog
爱范儿
爱范儿
月光博客
月光博客
V
Vulnerabilities – Threatpost
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
T
The Blog of Author Tim Ferriss
C
Cisco Blogs
Webroot Blog
Webroot Blog
S
Security @ Cisco Blogs

博客园 - yooooooo

ftraceoption irq-info MPAM BE/ FE 的区别及功能 【ARM CoreLink 系列 5 -- CI-700 控制器介绍 】 ARM CoreLink 系列 4.3 -- NI-700 Component and interface identifiers ARM CCI-500 与 NI0700 的关系. ARM NIC-400 与 NI-700 的区别 claude code命令使用 【ARM Trace32(劳特巴赫) 使用介绍 2.2 -- TRACE32 进阶命令之 DIAG 弹框命令】 trace32 .cmm脚本和.t32文件的区别 【ARM Trace32(劳特巴赫) 使用介绍 2.1 -- TRACE32 Practice 脚本 cmm 脚本学习】 【ARM Trace32(劳特巴赫) 使用介绍 1.1 - Veloce 环境中使用trace32 连接 Cortex-M33】 PCIe 总线的 ASPM 和 链路状态机制总结 fw_devlink 功能 I3C协议详解 UART 协议规范 BPF 调度器 sched_ext 实现机制、调度流程及样例 Android Camera性能分析 录像Buffer Path详解 【UEFI基础】Protocol介绍 【UEFI实战】在库中使用全局变量 sched feature TTWU_QUEUE 【ARM CoreLink 系列 4.2 -- NI-700 Function units 详细介绍】 edk2构建编译流程 UEFI:FDF文件及FD、FV、FFS EDK II PCD的概念、类型、使用 PELT算法浅析 load_balance函数代码详解 UEFI Boot Manager Linux 内核中sched_prio_to_weight转换关系 CFS任务放置代码详解 CFS任务的负载均衡(load balance)
Linux misfit task
yooooooo · 2025-11-09 · via 博客园 - yooooooo

在 Linux 内核中,“misfit task” 是调度器(scheduler)中的一个术语,用来描述任务(task)与 CPU 性能等级不匹配的情况。
这个概念主要出现在 EAS(Energy Aware Scheduling)/schedutil 等现代调度框架中,用于优化性能和功耗平衡。

一、定义

“Misfit task” 指的是:

当前 CPU 的算力不足以高效运行该任务,该任务应该被迁移到一个性能更强的 CPU 上。

换句话说,就是任务被分配到了一个 “太弱的核” 上,比如把高负载任务放在 LITTLE 核(A55)上。

二、出现背景

在 big.LITTLE 架构(异构多核)中,CPU 分为:

  • big 核:性能高,功耗高;
  • LITTLE 核:性能低,功耗低。

调度器为了省电,会优先在 LITTLE 核上运行任务。
但有些任务实际负载较大,会让 LITTLE 核满负荷运行,却仍然执行缓慢——这就是 misfit task

三、判断逻辑(代码角度)

kernel/sched/fair.c 中,Linux 内核通过计算任务的 负载与 CPU capacity 的比例 来判断:

if (task_util(p) > capacity_of(cpu))
    mark_cpu_has_misfit_task(cpu);

解释:

  • task_util(p):任务当前的 CPU utilization(通常来自 PELT 负载模型);
  • capacity_of(cpu):当前 CPU 的算力(会受 DVFS、EAS 等影响);
  • 当任务的需求超过该 CPU 的能力,就认为这个 CPU 上存在 misfit task

四、调度器行为

一旦 CPU 被标记为有 misfit task

  1. 调度器会在 负载均衡(load balance) 时尝试将这个任务迁移到更强的 CPU;
  2. 通常发生在 find_busiest_group()find_busiest_queue() 的过程中;
  3. EAS 模式下,还可能触发性能域(performance domain)的能量模型更新。

简化示意:

task_util = 700
cpu0_capacity = 512 (LITTLE)
cpu4_capacity = 1024 (big)

→ 任务在 cpu0 上是 misfit task → scheduler 会迁移到 cpu4

五、相关内核变量

你可以在 /proc/sys/kernel/sched_* 或调度 trace 中看到类似字段:

  • misfit_task:当前 CPU 是否存在 misfit task;
  • sched_cpu_misfit:在负载均衡时的迁移统计;
  • trace_sched_misfit_task:ftrace 事件,用于分析任务迁移原因。

六、调度优化意义

  • 避免任务卡在低性能核上;
  • 提升响应速度;
  • 让 big.LITTLE 调度更加智能;
  • 减少因错误核绑定导致的延迟。

七、总结一句话

misfit task = 当前核跑不动的任务
内核检测到后,会尽快把它迁移到性能更强的 CPU 上,从而提升整体性能。