mirror of
https://github.com/gatieme/LDD-LinuxDeviceDrivers.git
synced 2026-08-19 01:22:36 +08:00
DESCRIPTION: livepatch
This commit is contained in:
Executable
+293
@@ -0,0 +1,293 @@
|
||||
2 **子系统**
|
||||
=====================
|
||||
|
||||
|
||||
|
||||
|
||||
**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 重要功能和时间点 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-***
|
||||
|
||||
|
||||
下文将按此目录分析 Linux 内核中 MM 的重要功能和引入版本:
|
||||
|
||||
|
||||
|
||||
|
||||
**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 正文 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-***
|
||||
|
||||
|
||||
# 1 热补丁实现方案
|
||||
-------
|
||||
|
||||
在主线内核实现热补丁特性之前, 各个厂商就在社区进行了激烈的讨论, 并各自形成了自己的一套方案.
|
||||
|
||||
| 方案 | 作者 | 实现 | 一致性模型 | 限制与约束 |
|
||||
|:---:|:----:|:---:|:--------:|:---------:|
|
||||
| KGraft | SUSE 的 Jiri Kosina(JK) 和 Jiri Slaby(JS) 合作开发 | 基于 ftrace 方案实现, 采用类 RCU 更新机制 | 只要不会出现同一个 universe 里既调用了旧函数又调用了新函数的情况, 那么就是一致的<br>对于用户进程, 同一次系统调用是一次 universe<br>对于内核线程, 每次被唤醒, 判断是否被 stop 条件之后算是一个新的universe<br>对于中断, 同一次中断处理算是一次 universe | 仅支持 X86_64/s390, 未公开自动化热补丁制作工具 |
|
||||
| Kpatch | REDHAT | 基于 ftrace 方案, 使用 stop_machine + 栈检查来保证一致性 | 使用 stop_machine 机制停下所有 CPU, 然后对所有的进程进行栈检查, 只有在没有任何进程执行被 patched 的函数的情况下, 才认为是安全的 | stop_machine 机制对业务有中断影响, 大概带来 1ms-40ms 的延迟<br>仅支持 X86_64 |
|
||||
| kpatch without stop_machine | HITACHI 的 Masami Hiramatsu | 基于 kpatch 方案, 取消了 stop_machine一致性检查 | 不再需要 stop_machine, 引入全局的院子计数器 refcounter, 跟踪目标函数的调用情况, 只有在目标函数没有被执行时(refcounter == 0), 才可以安全的进行替换 | 基于 kpatch<br>一致性检查存在安全问题 |
|
||||
| 直接跳转方案 | HUAWEI | 不基于 ftrace, 修改函数的前几条指令, 直接跳转到新函数 | 同 kpatch 类似, 采用 stop_machine + 栈检查来保证安全性 | 与 ftrace/kprobe 等同样修改函数指令的特性存在冲突 |
|
||||
|
||||
最终经过了激烈的讨论, 大家认为各家的方案都存在一些问题, 社区对于使用哪家的方案也一直犹豫不决. 最终 Redhat 主张先搞一个动态热补丁的通用框架, 基于 ftrace 方案, 完成函数热替换的最基本功能, 不保证安全性, 不使用任何安全性机制, 只通过通用的热补丁制作/注册和使用的接口. 作为一个过渡方案. 而各家 KGraft/Kpatch 基于这个框架完成自己的方案. 一致性模型待后期充分讨论和检验后再做决定. 这个提议的最大依据就是, 大部分的 CVE 补丁即使没有一致性保证, 也可以安全的以动态补丁的方式打上. 因此社区可以先合入这样一个通用的记住方案. 然后接下来在考虑各种一致性方案的问题, 可以选择一种最优的一致性方案, 也可以将各种方案都集成进来, 然后用户根据自己 patch 的特点, 选择不同的一致性模型. 这个提议得到了大多数人的支持, 并由 Redhat 的 Seth Jennings 负责实现这个通用的框架.
|
||||
|
||||
| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 |
|
||||
|:----:|:----:|:--:|:----:|:---------:|:----:|
|
||||
| 2014/12/16 | Seth Jennings | Kernel Live Patching | 内核热补丁的基础框架 | v7 ☑ 4.0-rc1 | [PatchWork](https://lore.kernel.org/patchwork/cover/527257), [LKML](https://www.lkml.org/lkml/2017/2/13/831) |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 3 一致性模型 consistency model
|
||||
-------
|
||||
|
||||
一致性模型是非常复杂的, 在第一版的 LIVE_PATCH 支持的时候, 邮件列表中分析了几种一致性模型, 但是却没有结论, 参见 [`Re: [PATCH 0/2] Kernel Live Patching
|
||||
`](https://lkml.org/lkml/2014/11/7/354).
|
||||
|
||||
在经过漫长的讨论之后, 基于 PER-TASK 的混合一致性模型合入了主线.
|
||||
|
||||
|
||||
| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 |
|
||||
|:----:|:----:|:--:|:----:|:---------:|:-----:|
|
||||
| 2017/2/13 | Josh Poimboeuf | livepatch: hybrid consistency model | 基于 Kgraft 的PER TASK 的状态检查和基于 Redhat 可靠的栈检查的混合一致性模型 | v4 ☑ 4.12-rc1 | [PatchWork](https://lore.kernel.org/patchwork/cover/760164), [LKML](https://www.lkml.org/lkml/2017/2/13/831) |
|
||||
|
||||
|
||||
这个一致性模型被称为 混合一致性模型 "hybrid consistency model", 因为他融合了
|
||||
|
||||
* Kgraft 的 per-task 一致性模型, 保证同一个 universe 里不同时调用了旧函数又调用了新函数的情况
|
||||
|
||||
* reliable stacktrace 可靠的栈检查, 保证被 patched 的函数不被执行
|
||||
|
||||
## 3.1 per-task consistency model
|
||||
-------
|
||||
|
||||
|
||||
|
||||
## 3.2 reliable stacktrace
|
||||
-------
|
||||
|
||||
|
||||
# 4 JUMP_LABEL 支持
|
||||
-------
|
||||
|
||||
kpatch 的实现一直是根据内核的进展而演进的, 对 JUMP_LABEL 的不断重试也体现除了这个问题的难搞.
|
||||
|
||||
* [Livepatch does not handle static keys #931](https://github.com/dynup/kpatch/pull/931)
|
||||
|
||||
* [Add jump label support #937](https://github.com/dynup/kpatch/pull/937)
|
||||
|
||||
* [Revert "create-diff-object: add jump label support"](https://github.com/dynup/kpatch/pull/944)
|
||||
|
||||
* [kpatch-build should warn about static keys #946](https://github.com/dynup/kpatch/issues/946)
|
||||
|
||||
最终主线内核通过这个补丁解决了对 JUMP_LABEL 的支持问题 [livepatch: Apply vmlinux-specific KLP relocations early](https://lore.kernel.org/patchwork/cover/1233223).
|
||||
|
||||
| 时间 | 作者 |特性 | 描述 | 是否合入主线 | 链接 |
|
||||
|:----:|:----:|:--:|:----:|:---------:|:----:|
|
||||
| 2017/03/28 | Dietmar Eggemann | [livepatch,module: Remove .klp.arch and module_disable_ro()](https://lore.kernel.org/patchwork/cover/1233213) | 增加 PELT 的跟踪点 | v1 | [PatchWork](https://lore.kernel.org/patchwork/cover/774154) |
|
||||
|
||||
|
||||
# 5 引入 shadow 支持结构体中扩充字段
|
||||
-------
|
||||
|
||||
| 时间 | 作者 |特性 | 描述 | 是否合入主线 | 链接 |
|
||||
|:----:|:----:|:--:|:----:|:---------:|:----:|
|
||||
| 2017/08/31 | Joe Lawrence | [livepatch: introduce shadow variable API](https://lore.kernel.org/patchwork/cover/827343) | 增加 SHADOW API 支持结构体中引入新的变量 | v6 ☑ 4.15-rc1 | [PatchWork](https://lore.kernel.org/patchwork/cover/827343) |
|
||||
|
||||
livepatch: introduce shadow variable API
|
||||
|
||||
# 6 架构支持
|
||||
-------
|
||||
|
||||
|
||||
|
||||
相关的文章介绍: [47].
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
**引用:**
|
||||
|
||||
<div id="ref-anchor-1"></div>
|
||||
- [1] [Single UNIX Specification](https://en.wikipedia.org/wiki/Single_UNIX_Specification%23Non-registered_Unix-like_systems)
|
||||
|
||||
<div id="ref-anchor-2"></div>
|
||||
- [2] [POSIX 关于调度规范的文档](http://nicolas.navet.eu/publi/SlidesPosixKoblenz.pdf)
|
||||
|
||||
<div id="ref-anchor-3"></div>
|
||||
- [3] [Towards Linux 2.6](https://link.zhihu.com/?target=http%3A//www.informatica.co.cr/linux-scalability/research/2003/0923.html)
|
||||
|
||||
<div id="ref-anchor-4"></div>
|
||||
- [4] [Linux内核发布模式与开发组织模式(1)](https://link.zhihu.com/?target=http%3A//larmbr.com/2013/11/02/Linux-kernel-release-process-and-development-dictator-%26-lieutenant-system_1/)
|
||||
|
||||
<div id="ref-anchor-5"></div>
|
||||
- [5] IBM developworks 上有一篇综述文章, 值得一读 :[Linux 调度器发展简述](https://link.zhihu.com/?target=http%3A//www.ibm.com/developerworks/cn/linux/l-cn-scheduler/)
|
||||
|
||||
<div id="ref-anchor-6"></div>
|
||||
- [6] [CFS group scheduling [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/240474/)
|
||||
|
||||
<div id="ref-anchor-7"></div>
|
||||
- [7] [http://lse.sourceforge.net/numa/](https://link.zhihu.com/?target=http%3A//lse.sourceforge.net/numa/)
|
||||
|
||||
<div id="ref-anchor-8"></div>
|
||||
- [8] [CFS bandwidth control [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/428230/)
|
||||
|
||||
<div id="ref-anchor-9"></div>
|
||||
- [9] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D5091faa449ee0b7d73bc296a93bca9540fc51d0a)
|
||||
|
||||
<div id="ref-anchor-10"></div>
|
||||
- [10] [DMA模式\_百度百科](https://link.zhihu.com/?target=http%3A//baike.baidu.com/view/196502.htm)
|
||||
|
||||
<div id="ref-anchor-11"></div>
|
||||
- [11] [进程的虚拟地址和内核中的虚拟地址有什么关系? - 詹健宇的回答](http://www.zhihu.com/question/34787574/answer/60214771)
|
||||
|
||||
<div id="ref-anchor-12"></div>
|
||||
- [12] [Physical Page Allocation](https://link.zhihu.com/?target=https%3A//www.kernel.org/doc/gorman/html/understand/understand009.html)
|
||||
|
||||
<div id="ref-anchor-13"></div>
|
||||
- [13] [The SLUB allocator [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/229984/)
|
||||
|
||||
<div id="ref-anchor-14"></div>
|
||||
- [14] [Lumpy Reclaim V3 [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/211199/)
|
||||
|
||||
<div id="ref-anchor-15"></div>
|
||||
- [15] [Group pages of related mobility together to reduce external fragmentation v28 [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/224254/)
|
||||
|
||||
<div id="ref-anchor-16"></div>
|
||||
- [16] [Memory compaction [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/368869/)
|
||||
|
||||
<div id="ref-anchor-17"></div>
|
||||
- [17] [kernel 3.10内核源码分析--TLB相关--TLB概念、flush、TLB lazy模式-humjb\_1983-ChinaUnix博客](https://link.zhihu.com/?target=http%3A//blog.chinaunix.net/uid-14528823-id-4808877.html)
|
||||
|
||||
<div id="ref-anchor-18"></div>
|
||||
- [18] [Toward improved page replacement[LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/226756/)
|
||||
|
||||
<div id="ref-anchor-19"></div>
|
||||
- [19] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D4f98a2fee8acdb4ac84545df98cccecfd130f8db)
|
||||
|
||||
<div id="ref-anchor-20"></div>
|
||||
- [20] [The state of the pageout scalability patches [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/286472/)
|
||||
|
||||
<div id="ref-anchor-21"></div>
|
||||
- [21] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D894bc310419ac95f4fa4142dc364401a7e607f65)
|
||||
|
||||
<div id="ref-anchor-22"></div>
|
||||
- [22] [Being nicer to executable pages [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/333742/)
|
||||
|
||||
<div id="ref-anchor-23"></div>
|
||||
- [23] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D8cab4754d24a0f2e05920170c845bd84472814c6)
|
||||
|
||||
<div id="ref-anchor-24"></div>
|
||||
- [24] [Better active/inactive list balancing [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/495543/)
|
||||
|
||||
<div id="ref-anchor-25"></div>
|
||||
- [25] [Smarter write throttling [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/245600/)
|
||||
|
||||
<div id="ref-anchor-26"></div>
|
||||
- [26] [https://zh.wikipedia.org/wiki/%E6%8C%87%E6%95%B0%E8%A1%B0%E5%87%8F](https://link.zhihu.com/?target=https%3A//zh.wikipedia.org/wiki/%25E6%258C%2587%25E6%2595%25B0%25E8%25A1%25B0%25E5%2587%258F)
|
||||
|
||||
<div id="ref-anchor-27"></div>
|
||||
- [27] [Flushing out pdflush [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/326552/)
|
||||
|
||||
<div id="ref-anchor-28"></div>
|
||||
- [28] [Dynamic writeback throttling [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/405076/)
|
||||
|
||||
<div id="ref-anchor-29"></div>
|
||||
- [29] [On-demand readahead [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/235164/)
|
||||
|
||||
<div id="ref-anchor-30"></div>
|
||||
- [30] [Transparent huge pages in 2.6.38 [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/423584/)
|
||||
|
||||
<div id="ref-anchor-31"></div>
|
||||
- [31] [https://events.linuxfoundation.org/sites/events/files/lcjp13\_ishimatsu.pdf](https://link.zhihu.com/?target=https%3A//events.linuxfoundation.org/sites/events/files/lcjp13_ishimatsu.pdf)
|
||||
|
||||
<div id="ref-anchor-32"></div>
|
||||
- [32] [transcendent memory for Linux [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/338098/)
|
||||
|
||||
<div id="ref-anchor-33"></div>
|
||||
- [33] [linux kernel monkey log](https://link.zhihu.com/?target=http%3A//www.kroah.com/log/linux/linux-staging-update.html)
|
||||
|
||||
<div id="ref-anchor-34"></div>
|
||||
- [34] [zcache: a compressed page cache [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/397574/)
|
||||
|
||||
<div id="ref-anchor-35"></div>
|
||||
- [35] [The zswap compressed swap cache [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/537422/)
|
||||
|
||||
<div id="ref-anchor-36"></div>
|
||||
- [36] [Linux-Kernel Archive: Linux 2.6.0](https://link.zhihu.com/?target=http%3A//lkml.iu.edu/hypermail/linux/kernel/0312.2/0348.html)
|
||||
|
||||
<div id="ref-anchor-37"></div>
|
||||
- [37]抢占支持的引入时间: [https://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.4](https://link.zhihu.com/?target=https%3A//www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.4)
|
||||
|
||||
<div id="ref-anchor-38"></div>
|
||||
- [38] [RAM is 100 Thousand Times Faster than Disk for Database Access](https://link.zhihu.com/?target=http%3A//www.directionsmag.com/entry/ram-is-100-thousand-times-faster-than-disk-for-database-access/123964)
|
||||
|
||||
<div id="ref-anchor-39"></div>
|
||||
- [39] [http://www.uefi.org/sites/default/files/resources/ACPI\_6.0.pdf](https://link.zhihu.com/?target=http%3A//www.uefi.org/sites/default/files/resources/ACPI_6.0.pdf)
|
||||
|
||||
<div id="ref-anchor-40"></div>
|
||||
- [40] [Injecting faults into the kernel [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/209257/)
|
||||
|
||||
<div id="ref-anchor-41"></div>
|
||||
- [41] [Detecting kernel memory leaks [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/187979/)
|
||||
|
||||
<div id="ref-anchor-42"></div>
|
||||
- [42] [The kernel address sanitizer [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/612153/)
|
||||
|
||||
<div id="ref-anchor-43"></div>
|
||||
- [43] [Linux Kernel Shared Memory 剖析](https://link.zhihu.com/?target=http%3A//www.ibm.com/developerworks/cn/linux/l-kernel-shared-memory/)
|
||||
|
||||
<div id="ref-anchor-44"></div>
|
||||
- [44] [KSM tries again [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/330589/)
|
||||
|
||||
<div id="ref-anchor-45"></div>
|
||||
- [45] [HWPOISON [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/348886/)
|
||||
|
||||
<div id="ref-anchor-46"></div>
|
||||
- [46] [https://www.mcs.anl.gov/research/projects/mpi/](https://link.zhihu.com/?target=https%3A//www.mcs.anl.gov/research/projects/mpi/)
|
||||
|
||||
<div id="ref-anchor-47"></div>
|
||||
- [47] [Fast interprocess messaging [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/405346/)
|
||||
|
||||
|
||||
|
||||
---8<---
|
||||
|
||||
**更新日志:**
|
||||
|
||||
**- 2015.9.12**
|
||||
|
||||
o 完成调度器子系统的初次更新, 从早上10点开始写, 写了近7小时, 比较累, 后面更新得慢的话大家不要怪我(对手指
|
||||
|
||||
**- 2015.9.19**
|
||||
|
||||
o 完成内存管理子系统的前4章更新. 同样是写了一天, 内容太多, 没能写完......
|
||||
|
||||
**- 2015.9.21**
|
||||
|
||||
o 完成内存管理子系统的第5章"页面写回"的第1小节的更新.
|
||||
**- 2015.9.25**
|
||||
|
||||
o 更改一些排版和个别文字描述. 接下来周末两天继续.
|
||||
**- 2015.9.26**
|
||||
|
||||
o 完成内存管理子系统的第5, 6, 7, 8章的更新.
|
||||
**- 2015.10.14**
|
||||
|
||||
o 国庆离网10来天, 未更新. 今天完成了内存管理子系统的第9章的更新.
|
||||
**- 2015.10.16**
|
||||
|
||||
o 完成内存管理子系统的第10章的更新.
|
||||
**- 2015.11.22**
|
||||
|
||||
o 这个月在出差和休假, 一直未更新.抱歉! 根据知友 [@costa](https://www.zhihu.com/people/78ceb98e7947731dc06063f682cf9640) 提供的无水印图片和考证资料, 进行了一些小更新和修正. 特此感谢 !
|
||||
|
||||
o 完成内存管理子系统的第11章关于 NVDIMM 内容的更新.
|
||||
**- 2016.1.2**
|
||||
|
||||
o 中断许久, 今天完成了内存管理子系统的第11章关于调试支持内容的更新.
|
||||
**- 2016.2.23**
|
||||
|
||||
o 又中断许久, 因为懒癌发作Orz... 完成了第二个子系统的所有章节.
|
||||
[编辑于 06-27](https://www.zhihu.com/question/35484429/answer/62964898)
|
||||
Regular → Executable
+1
@@ -56,6 +56,7 @@
|
||||
|:---:|:------:|
|
||||
| **调度子系统(scheduling) [已完成]** | [`SCHEDULER`](https://github.com/gatieme/LDD-LinuxDeviceDrivers/blob/master/study/kernel/00-DESCRIPTION/SCHEDULER.md) |
|
||||
| **内存管理子系统(memory management) [已完成]** | [`MEMORY_MANAGER`](https://github.com/gatieme/LDD-LinuxDeviceDrivers/blob/master/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md) |
|
||||
| **热补丁** | [填坑中] |
|
||||
| **中断与异常子系统(interrupt & exception)[填坑中]** | |
|
||||
| **时间子系统(timer & timekeeping)** | |
|
||||
| **同步机制子系统(synchronization)** | |
|
||||
|
||||
Executable
+212
@@ -0,0 +1,212 @@
|
||||
2 **子系统**
|
||||
=====================
|
||||
|
||||
|
||||
|
||||
|
||||
**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 重要功能和时间点 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-***
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
下文将按此目录分析 Linux 内核中 MM 的重要功能和引入版本:
|
||||
|
||||
|
||||
|
||||
|
||||
**-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 正文 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-***
|
||||
|
||||
|
||||
|
||||
相关的文章介绍: [47].
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
**引用:**
|
||||
|
||||
<div id="ref-anchor-1"></div>
|
||||
- [1] [Single UNIX Specification](https://en.wikipedia.org/wiki/Single_UNIX_Specification%23Non-registered_Unix-like_systems)
|
||||
|
||||
<div id="ref-anchor-2"></div>
|
||||
- [2] [POSIX 关于调度规范的文档](http://nicolas.navet.eu/publi/SlidesPosixKoblenz.pdf)
|
||||
|
||||
<div id="ref-anchor-3"></div>
|
||||
- [3] [Towards Linux 2.6](https://link.zhihu.com/?target=http%3A//www.informatica.co.cr/linux-scalability/research/2003/0923.html)
|
||||
|
||||
<div id="ref-anchor-4"></div>
|
||||
- [4] [Linux内核发布模式与开发组织模式(1)](https://link.zhihu.com/?target=http%3A//larmbr.com/2013/11/02/Linux-kernel-release-process-and-development-dictator-%26-lieutenant-system_1/)
|
||||
|
||||
<div id="ref-anchor-5"></div>
|
||||
- [5] IBM developworks 上有一篇综述文章, 值得一读 :[Linux 调度器发展简述](https://link.zhihu.com/?target=http%3A//www.ibm.com/developerworks/cn/linux/l-cn-scheduler/)
|
||||
|
||||
<div id="ref-anchor-6"></div>
|
||||
- [6] [CFS group scheduling [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/240474/)
|
||||
|
||||
<div id="ref-anchor-7"></div>
|
||||
- [7] [http://lse.sourceforge.net/numa/](https://link.zhihu.com/?target=http%3A//lse.sourceforge.net/numa/)
|
||||
|
||||
<div id="ref-anchor-8"></div>
|
||||
- [8] [CFS bandwidth control [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/428230/)
|
||||
|
||||
<div id="ref-anchor-9"></div>
|
||||
- [9] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D5091faa449ee0b7d73bc296a93bca9540fc51d0a)
|
||||
|
||||
<div id="ref-anchor-10"></div>
|
||||
- [10] [DMA模式\_百度百科](https://link.zhihu.com/?target=http%3A//baike.baidu.com/view/196502.htm)
|
||||
|
||||
<div id="ref-anchor-11"></div>
|
||||
- [11] [进程的虚拟地址和内核中的虚拟地址有什么关系? - 詹健宇的回答](http://www.zhihu.com/question/34787574/answer/60214771)
|
||||
|
||||
<div id="ref-anchor-12"></div>
|
||||
- [12] [Physical Page Allocation](https://link.zhihu.com/?target=https%3A//www.kernel.org/doc/gorman/html/understand/understand009.html)
|
||||
|
||||
<div id="ref-anchor-13"></div>
|
||||
- [13] [The SLUB allocator [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/229984/)
|
||||
|
||||
<div id="ref-anchor-14"></div>
|
||||
- [14] [Lumpy Reclaim V3 [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/211199/)
|
||||
|
||||
<div id="ref-anchor-15"></div>
|
||||
- [15] [Group pages of related mobility together to reduce external fragmentation v28 [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/224254/)
|
||||
|
||||
<div id="ref-anchor-16"></div>
|
||||
- [16] [Memory compaction [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/368869/)
|
||||
|
||||
<div id="ref-anchor-17"></div>
|
||||
- [17] [kernel 3.10内核源码分析--TLB相关--TLB概念、flush、TLB lazy模式-humjb\_1983-ChinaUnix博客](https://link.zhihu.com/?target=http%3A//blog.chinaunix.net/uid-14528823-id-4808877.html)
|
||||
|
||||
<div id="ref-anchor-18"></div>
|
||||
- [18] [Toward improved page replacement[LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/226756/)
|
||||
|
||||
<div id="ref-anchor-19"></div>
|
||||
- [19] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D4f98a2fee8acdb4ac84545df98cccecfd130f8db)
|
||||
|
||||
<div id="ref-anchor-20"></div>
|
||||
- [20] [The state of the pageout scalability patches [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/286472/)
|
||||
|
||||
<div id="ref-anchor-21"></div>
|
||||
- [21] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D894bc310419ac95f4fa4142dc364401a7e607f65)
|
||||
|
||||
<div id="ref-anchor-22"></div>
|
||||
- [22] [Being nicer to executable pages [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/333742/)
|
||||
|
||||
<div id="ref-anchor-23"></div>
|
||||
- [23] [kernel/git/torvalds/linux.git](https://link.zhihu.com/?target=https%3A//git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/%3Fid%3D8cab4754d24a0f2e05920170c845bd84472814c6)
|
||||
|
||||
<div id="ref-anchor-24"></div>
|
||||
- [24] [Better active/inactive list balancing [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/495543/)
|
||||
|
||||
<div id="ref-anchor-25"></div>
|
||||
- [25] [Smarter write throttling [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/245600/)
|
||||
|
||||
<div id="ref-anchor-26"></div>
|
||||
- [26] [https://zh.wikipedia.org/wiki/%E6%8C%87%E6%95%B0%E8%A1%B0%E5%87%8F](https://link.zhihu.com/?target=https%3A//zh.wikipedia.org/wiki/%25E6%258C%2587%25E6%2595%25B0%25E8%25A1%25B0%25E5%2587%258F)
|
||||
|
||||
<div id="ref-anchor-27"></div>
|
||||
- [27] [Flushing out pdflush [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/326552/)
|
||||
|
||||
<div id="ref-anchor-28"></div>
|
||||
- [28] [Dynamic writeback throttling [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/405076/)
|
||||
|
||||
<div id="ref-anchor-29"></div>
|
||||
- [29] [On-demand readahead [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/235164/)
|
||||
|
||||
<div id="ref-anchor-30"></div>
|
||||
- [30] [Transparent huge pages in 2.6.38 [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/423584/)
|
||||
|
||||
<div id="ref-anchor-31"></div>
|
||||
- [31] [https://events.linuxfoundation.org/sites/events/files/lcjp13\_ishimatsu.pdf](https://link.zhihu.com/?target=https%3A//events.linuxfoundation.org/sites/events/files/lcjp13_ishimatsu.pdf)
|
||||
|
||||
<div id="ref-anchor-32"></div>
|
||||
- [32] [transcendent memory for Linux [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/338098/)
|
||||
|
||||
<div id="ref-anchor-33"></div>
|
||||
- [33] [linux kernel monkey log](https://link.zhihu.com/?target=http%3A//www.kroah.com/log/linux/linux-staging-update.html)
|
||||
|
||||
<div id="ref-anchor-34"></div>
|
||||
- [34] [zcache: a compressed page cache [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/397574/)
|
||||
|
||||
<div id="ref-anchor-35"></div>
|
||||
- [35] [The zswap compressed swap cache [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/537422/)
|
||||
|
||||
<div id="ref-anchor-36"></div>
|
||||
- [36] [Linux-Kernel Archive: Linux 2.6.0](https://link.zhihu.com/?target=http%3A//lkml.iu.edu/hypermail/linux/kernel/0312.2/0348.html)
|
||||
|
||||
<div id="ref-anchor-37"></div>
|
||||
- [37]抢占支持的引入时间: [https://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.4](https://link.zhihu.com/?target=https%3A//www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.4)
|
||||
|
||||
<div id="ref-anchor-38"></div>
|
||||
- [38] [RAM is 100 Thousand Times Faster than Disk for Database Access](https://link.zhihu.com/?target=http%3A//www.directionsmag.com/entry/ram-is-100-thousand-times-faster-than-disk-for-database-access/123964)
|
||||
|
||||
<div id="ref-anchor-39"></div>
|
||||
- [39] [http://www.uefi.org/sites/default/files/resources/ACPI\_6.0.pdf](https://link.zhihu.com/?target=http%3A//www.uefi.org/sites/default/files/resources/ACPI_6.0.pdf)
|
||||
|
||||
<div id="ref-anchor-40"></div>
|
||||
- [40] [Injecting faults into the kernel [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/209257/)
|
||||
|
||||
<div id="ref-anchor-41"></div>
|
||||
- [41] [Detecting kernel memory leaks [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/187979/)
|
||||
|
||||
<div id="ref-anchor-42"></div>
|
||||
- [42] [The kernel address sanitizer [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/612153/)
|
||||
|
||||
<div id="ref-anchor-43"></div>
|
||||
- [43] [Linux Kernel Shared Memory 剖析](https://link.zhihu.com/?target=http%3A//www.ibm.com/developerworks/cn/linux/l-kernel-shared-memory/)
|
||||
|
||||
<div id="ref-anchor-44"></div>
|
||||
- [44] [KSM tries again [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/330589/)
|
||||
|
||||
<div id="ref-anchor-45"></div>
|
||||
- [45] [HWPOISON [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/348886/)
|
||||
|
||||
<div id="ref-anchor-46"></div>
|
||||
- [46] [https://www.mcs.anl.gov/research/projects/mpi/](https://link.zhihu.com/?target=https%3A//www.mcs.anl.gov/research/projects/mpi/)
|
||||
|
||||
<div id="ref-anchor-47"></div>
|
||||
- [47] [Fast interprocess messaging [LWN.net]](https://link.zhihu.com/?target=https%3A//lwn.net/Articles/405346/)
|
||||
|
||||
|
||||
|
||||
---8<---
|
||||
|
||||
**更新日志:**
|
||||
|
||||
**- 2015.9.12**
|
||||
|
||||
o 完成调度器子系统的初次更新, 从早上10点开始写, 写了近7小时, 比较累, 后面更新得慢的话大家不要怪我(对手指
|
||||
|
||||
**- 2015.9.19**
|
||||
|
||||
o 完成内存管理子系统的前4章更新. 同样是写了一天, 内容太多, 没能写完......
|
||||
|
||||
**- 2015.9.21**
|
||||
|
||||
o 完成内存管理子系统的第5章"页面写回"的第1小节的更新.
|
||||
**- 2015.9.25**
|
||||
|
||||
o 更改一些排版和个别文字描述. 接下来周末两天继续.
|
||||
**- 2015.9.26**
|
||||
|
||||
o 完成内存管理子系统的第5, 6, 7, 8章的更新.
|
||||
**- 2015.10.14**
|
||||
|
||||
o 国庆离网10来天, 未更新. 今天完成了内存管理子系统的第9章的更新.
|
||||
**- 2015.10.16**
|
||||
|
||||
o 完成内存管理子系统的第10章的更新.
|
||||
**- 2015.11.22**
|
||||
|
||||
o 这个月在出差和休假, 一直未更新.抱歉! 根据知友 [@costa](https://www.zhihu.com/people/78ceb98e7947731dc06063f682cf9640) 提供的无水印图片和考证资料, 进行了一些小更新和修正. 特此感谢 !
|
||||
|
||||
o 完成内存管理子系统的第11章关于 NVDIMM 内容的更新.
|
||||
**- 2016.1.2**
|
||||
|
||||
o 中断许久, 今天完成了内存管理子系统的第11章关于调试支持内容的更新.
|
||||
**- 2016.2.23**
|
||||
|
||||
o 又中断许久, 因为懒癌发作Orz... 完成了第二个子系统的所有章节.
|
||||
[编辑于 06-27](https://www.zhihu.com/question/35484429/answer/62964898)
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
---
|
||||
|
||||
title: 从 NUMA 3 跳(3-HOPS)问题入手--窥--内核调度域的构建
|
||||
date: 2021-01-24 18:40
|
||||
author: gatieme
|
||||
tags:
|
||||
- debug
|
||||
- linux
|
||||
- scheduler
|
||||
categories:
|
||||
- scheduler
|
||||
|
||||
thumbnail:
|
||||
blogexcerpt: 这篇文章旨在帮助希望更好地分析其应用程序中性能瓶颈的人们. 有许多现有的方法可以进行性能分析, 但其中没有很多方法既健壮又正式. 而 TOPDOWN 则为大家进行软硬协同分析提供了无限可能. 本文通过 pmu-tools 入手帮助大家进行 TOPDOWN 分析.
|
||||
|
||||
|
||||
---
|
||||
|
||||
| CSDN | GitHub | OSKernelLAB |
|
||||
|:----:|:------:|:-----------:|
|
||||
| [紫夜阑珊-青伶巷草](https://blog.csdn.net/gatieme/article/details/113269052) | [`LDD-LinuxDeviceDrivers`](https://github.com/gatieme/LDD-LinuxDeviceDrivers/tree/master/study/debug/tools/topdown/pmu-tools) | [Intel CPU 上使用 pmu-tools 进行 TopDown 分析](https://oskernellab.com/2021/01/24/2021/0127-0001-Topdown_analysis_as_performed_on_Intel_CPU_using_pmu-tools/) |
|
||||
|
||||
<br>
|
||||
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>
|
||||
|
||||
本作品采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a>进行许可, 转载请注明出处, 谢谢合作.
|
||||
|
||||
因本人技术水平和知识面有限, 内容如有纰漏或者需要修正的地方, 欢迎大家指正, 鄙人在此谢谢啦
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
# 1 问题描述(一个性能优化补丁导致的性能回归)
|
||||
-------
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
* 本作品/博文 ( [AderStep-紫夜阑珊-青伶巷草 Copyright ©2013-2017](http://blog.csdn.net/gatieme) ), 由 [成坚(gatieme)](http://blog.csdn.net/gatieme) 创作.
|
||||
|
||||
* 采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a>进行许可. 欢迎转载、使用、重新发布, 但务必保留文章署名[成坚gatieme](http://blog.csdn.net/gatieme) ( 包含链接: http://blog.csdn.net/gatieme ), 不得用于商业目的.
|
||||
|
||||
* 基于本文修改后的作品务必以相同的许可发布. 如有任何疑问, 请与我联系.
|
||||
Reference in New Issue
Block a user