From de0020907d5b744e83538fd0e28e09cef342e8f1 Mon Sep 17 00:00:00 2001 From: Cheng Jian Date: Mon, 24 Jan 2022 23:25:21 +0800 Subject: [PATCH] description: update 20220124 --- study/arch/cache/Cache/README.md | 13 +++++ study/kernel/00-DESCRIPTION/ARCH.md | 58 ++++++++++++++++++- study/kernel/00-DESCRIPTION/DEBUGGING.md | 50 ++++++++++++++-- study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md | 22 ++++++- study/kernel/00-DESCRIPTION/SCHEDULER.md | 3 +- study/kernel/00-DESCRIPTION/TOOLS.md | 5 ++ 6 files changed, 144 insertions(+), 7 deletions(-) diff --git a/study/arch/cache/Cache/README.md b/study/arch/cache/Cache/README.md index 639c163..4a6aff7 100644 --- a/study/arch/cache/Cache/README.md +++ b/study/arch/cache/Cache/README.md @@ -223,6 +223,19 @@ cache hier 的问题: 在不同的微架构中, L1 与 L2 的关系可以是 inc 2. Cache line, cache page 中更小的单元, cache 缓存的最小单位. + +# 替换算法 +------- + +[一种缓存替换策略:DYNAMIC RE-REFERENCE INTERVAL PREDICTION (RRIP)](https://constd.com/2015/09/20/drrip) + +[Cache 替换策略](https://zhuanlan.zhihu.com/p/54829644) + +[Intel Ivy Bridge Cache Replacement Policy](https://blog.stuffedcow.net/2013/01/ivb-cache-replacement) + +[High Performance Cache Replacement Using Re-Reference Interval Prediction](https://wangziqi2013.github.io/paper/2018/06/19/RRIP.html) + + # 4 参考资料 ------- diff --git a/study/kernel/00-DESCRIPTION/ARCH.md b/study/kernel/00-DESCRIPTION/ARCH.md index 7be3dbb..55eaead 100644 --- a/study/kernel/00-DESCRIPTION/ARCH.md +++ b/study/kernel/00-DESCRIPTION/ARCH.md @@ -221,6 +221,9 @@ ARM64 架构文档地址下载 [](https://developer.arm.com/architectures/cpu-ar [Memory Layout on AArch64 Linux](https://www.kernel.org/doc/html/latest/arm64/memory.html) +[ARM64 Instruction](https://courses.cs.washington.edu/courses/cse469/19wi/arm64.pdf) + +[硬件特性列表](https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools/feature-names-for-a-profile) | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| @@ -348,7 +351,7 @@ TLB entry shootdown 常常或多或少的带来一些性能问题. | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| -| 2021/10/27 | Mark Brown | [arm64/sme: Initial support for the Scalable Matrix Extension](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211027184424.166237-1-broonie@kernel.org) | SME 指令的支持. v7 版本前 6 个 [prepare 的补丁](https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.17-AArch64)先合入了 [5.17-rc1](https://lore.kernel.org/lkml/20220106185501.1480075-1-catalin.marinas@arm.com) | v5 ☐ | [2021/10/27 Patchwork v5,00/38](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211027184424.166237-1-broonie@kernel.org)
*-*-*-*-*-*-*-*
[2021/12/10 Patchwork v7,00/37](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211210184133.320748-1-broonie@kernel.org) | +| 2021/10/27 | Mark Brown | [arm64/sme: Initial support for the Scalable Matrix Extension](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211027184424.166237-1-broonie@kernel.org) | SME 指令的支持. v7 版本前 6 个 [prepare 的补丁](https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.17-AArch64)先合入了 [5.17-rc1](https://lore.kernel.org/lkml/20220106185501.1480075-1-catalin.marinas@arm.com) | v5 ☐ | [LORE v3,00/42](https://lore.kernel.org/all/20211019172247.3045838-1-broonie@kernel.org)
*-*-*-*-*-*-*-*
[2021/10/27 Patchwork v5,00/38](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211027184424.166237-1-broonie@kernel.org)
*-*-*-*-*-*-*-*
[2021/12/10 Patchwork v7,00/37](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20211210184133.320748-1-broonie@kernel.org) | ## 2.4 pseudo-NMI ------- @@ -366,11 +369,64 @@ TLB entry shootdown 常常或多或少的带来一些性能问题. [armv8/arm64 PAN 深入分析](https://cloud.tencent.com/developer/article/1413360) +[Arm64 架构安全 -- PAN](https://zhuanlan.zhihu.com/p/365701044) + +一般控制一个内存的属性, 如 RWX 权限, 简单的想 3 个 bit 即可, 但是当前操作系统的设计 RWX 权限除了要表示内核的权限以外还要包括用户态的权限, 那么需要就需要 6 个 bit. 但是在 ARM v8 的设计中, 为了节省相应的页表设计 ARM 仅用了 4 个 bit. + +| 控制位 | 描述 | +|:-----:|:---:| +| UXN(BIT [54]) | 设置为 1 的时候, 用户态没有执行权限 | +| PXN(BIT [53]) | 设置为 1 的时候, 内核态没有执行权限 | +| AP [2](BIT [7]) | 1 表示内核态是 readonly, 0 表示内核态是 RW 权限 | +| AP [1](BIT [6]) | 1 表示用户态跟内核态的权限一样, 0 表示用户态没有任何权限 | + +这就导致了一个问题, 那就是无论怎么设置页表的权限, 只要用户态有权限, 此时内核态的权限跟用户态的权限一致. + +这原本貌似也没什么问题, 但是后来安全研究人员发现, 由于内核态可以直接执行相应的用户态程序, 这样攻击者就可以在用户态准备好相应执行的代码, 如果内核里边有一个很小的漏洞, 比如 ROP, 攻击者通过 RetToUser Attrack 把相应的栈中的 ret 值修改为用户态准备好的地址, 那么就可以轻松做到任意代码执行. + +为了解决这个问题, ARM v8.1 在修复这个问题的时候, 不得不在 pstate 中抠出来一个 bit 来设置 PAN(Privileged Access Never), 如果 PAN 为 1 的时候, 那么就限制在 EL1 里边不允许访问 EL0 的内存. 被称为 ARMv8.1-PAN, Privileged access never, 它的主要工作就是限制内核态不能访问用户态的数据. 如果启用了 CONFIG_ARM64_PAN, 内核试图访问用户空间的内存时, 则会报权限错误, 相反, [copy_from_user()](https://elixir.bootlin.com/linux/v4.3/source/arch/arm64/lib/copy_from_user.S#L34) 以及 [copy_to_user()](https://elixir.bootlin.com/linux/v4.3/source/arch/arm64/lib/copy_to_user.S#L35) 等接口中访问用户空间内存时必须清除 PAN 位(或使用 `ldt*/stt*` 指令), 在完成后则必须恢复. + +[Arm Chips Vulnerable to PAN Bypass – "We All Know it’s Broken"](https://techmonitor.ai/techonology/hardware/arm-pan-bypass) +[PAN](https://blog.siguza.net/PAN) | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| +| 2015/07/16 | James Morse | [arm64: kernel: Add support for Privileged Access Never](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=338d4f49d6f7114a017d294ccf7374df4f998edc) | 实现 ARMv8.1-PAN, Privileged access never. | v4 ☑ 4.3-rc1 | [LORE 0/5](https://lore.kernel.org/linux-arm-kernel/1437062519-18883-1-git-send-email-james.morse@arm.com)
*-*-*-*-*-*-*-*
[LORE v3,0/6](https://lore.kernel.org/all/1437481411-1595-1-git-send-email-james.morse@arm.com)
*-*-*-*-*-*-*-*
[LORE v4,rebase](https://lore.kernel.org/all/1437588354-31278-1-git-send-email-james.morse@arm.com), [关键 COMMIT](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=338d4f49d6f7114a017d294ccf7374df4f998edc) | +| 2016/10/18 | James Morse | [PAN Fixes](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=d08544127d9fb4505635e3cb6871fd50a42947bd) | 修复 PAN 代码上的一些问题. | v1 ☑ 4.9-rc2 | [LORE 0/3](https://lore.kernel.org/all/1476786468-2173-1-git-send-email-james.morse@arm.com) | + +ARMv8.2-ATS1E1, AT S1E1R and AT S1E1W instruction variants, taking account of PSTATE.PAN + + +开启了 PAN 之后, 内核每次 copy_from_user/copy_to_user 需要访问用户态地址的时候, 不得不动态的禁用和使能 PAN. 于是, 在 ARM v8.2 又引入了 UAO(User Access Override). 与 LDR/STR 指令不同, UAO 提供了 LDTR/STTR 等非特权 load/store 指令, 不管在哪个 ELx 态(即使是 EL1 或 EL2) 运行, 它们都也会根据 EL0 权限检查进行检查. 并且不会被 PAN 阻止. + +如果发现当前 CPU ARM64_HAS_UAO, 则会通过 alternative 机制将 [copy_from_user](https://elixir.bootlin.com/linux/v4.6/source/arch/arm64/lib/copy_from_user.S#L70) 以及 copy_to_user 等函数中访问用户态的指令[替换为 ldtr/sttr](https://elixir.bootlin.com/linux/v4.6/source/arch/arm64/include/asm/alternative.h#L148) 等. 而把[使能和禁用 PAN 的操作替换为 NOP](https://elixir.bootlin.com/linux/v4.6/source/arch/arm64/include/asm/uaccess.h#L75) 操作. + + +[Learn the architecture: AArch64 memory model/Permissions attributes](https://developer.arm.com/documentation/102376/0100/Permissions-attributes) + +[UAO (User Access Override) as a mitigation against addr_limit overwrites](https://duasynt.com/blog/android-uao-kernel-expl-mitigation) + +ARM v8.2 引入了 [UAO](https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-a-architecture-evolution) + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2016/02/05 | James Morse | [arm64: kernel: Add support for User Access Override](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=705441960033e66b63524521f153fbb28c99ddbd) | 引入 hugetlb cgroup | v2 ☑ 4.6-rc1 | [LORE v1,0/5](https://lore.kernel.org/linux-arm-kernel/1454432611-21333-1-git-send-email-james.morse@arm.com)
*-*-*-*-*-*-*-*
[LORE v2,0/5](https://lore.kernel.org/linux-arm-kernel/1454684330-892-1-git-send-email-james.morse@arm.com) | + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2016/10/28 | Catalin Marinas | [arm64: Privileged Access Never using TTBR0_EL1 switching](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=ba42822af1c287f038aa550f3578c61c212a892e) | 引入 CONFIG_ARM64_SW_TTBR0_PAN, 通过软件模拟实现 PAN. 通过将 TTBR0_EL1 指向保留的归零区域和保留的 ASID, 防止内核直接访问用户空间内存. 用户访问例程临时恢复有效的 TTBR0_EL1. | v4 ☑ 4.10-rc1 | [LORE v1,0/7](https://lore.kernel.org/linux-arm-kernel/1471015666-23125-1-git-send-email-catalin.marinas@arm.com)
*-*-*-*-*-*-*-*
[LORE v3,0/7](https://lore.kernel.org/linux-arm-kernel/1473788797-10879-1-git-send-email-catalin.marinas@arm.com)
*-*-*-*-*-*-*-*
[LORE v4,0/8](https://lore.kernel.org/linux-arm-kernel/1477675636-3957-1-git-send-email-catalin.marinas@arm.com) | + + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2020/12/02 | Paul Gortmaker | [arm64: remove set_fs() and friends](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=1517c4facf2e66401394998dba1ee236fd261310) | 引入 hugetlb cgroup | v5 ☑ 5.11-rc1 | [LKML v5,00/12](https://patchwork.kernel.org/project/linux-arm-kernel/cover/20201202131558.39270-1-mark.rutland@arm.com), [LORE](https://lore.kernel.org/r/20201202131558.39270-13-mark.rutland@arm.com) | | 2021/03/12 | Vladimir Murzin | [arm64: Support Enhanced PAN](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=18107f8a2df6bf1c6cac8d0713f757f866d5af51) | NA | v4 ☑ 5.13-rc1 | [LORE v4,0/2](https://lore.kernel.org/all/20210312173811.58284-1-vladimir.murzin@arm.com) | + + + + + ## 2.6 PAC ------- diff --git a/study/kernel/00-DESCRIPTION/DEBUGGING.md b/study/kernel/00-DESCRIPTION/DEBUGGING.md index 713de06..374cd9b 100644 --- a/study/kernel/00-DESCRIPTION/DEBUGGING.md +++ b/study/kernel/00-DESCRIPTION/DEBUGGING.md @@ -201,13 +201,14 @@ Facebook 在 2018 年开源了一套解决重要计算集群管理问题的 Linu | 2019/04/09 | Rasmus Villemoes | [implement DYNAMIC_DEBUG_RELATIVE_POINTERS](https://lore.kernel.org/patchwork/patch/1059829) | 实现 DYNAMIC_DEBUG_RELATIVE_POINTERS | v1 ☐ | [Patchwork ](https://lore.kernel.org/patchwork/patch/1059829) | - -# 8 DRGN +# 8 VDSO ------- -[LWN/A kernel debugger in Python: drgn(https://lwn.net/Articles/789641) -[LWN: 想用python命令来调试kernel吗?drgn就是了!](https://blog.csdn.net/Linux_Everything/article/details/93270705) +[Remove cached PID/TID in clone](https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=c579f48edba88380635ab98cb612030e3ed8691e) +[Bug 1469670 - glibc: Implement vDSO-based getpid](https://bugzilla.redhat.com/show_bug.cgi?id=1469670) +[Bug 1469757 - kernel: Implement vDSO support for getpid](https://bugzilla.redhat.com/show_bug.cgi?id=1469757) +[Why getpid() is not implemented in x86_64's vdso?](https://stackoverflow.com/questions/65454115/why-getpid-is-not-implemented-in-x86-64s-vdso) # 9 PRINTK @@ -517,6 +518,36 @@ https://patchwork.kernel.org/project/linux-trace-devel/list/?submitter=200911&st # 15 kptr_restrict ------- + +# 16 Generic Kernel Image(GKI) +------- + + +谷歌的Android因其移动操作系统以及各种供应商/设备内核树所携带的所有下游补丁而臭名昭著, 而近年来, 更多的代码已经上游. 谷歌也一直在转向Android通用内核映像(GKI)作为其所有产品内核的基础, 以进一步减少碎片化. 展望未来, 谷歌在 2021 年北美开源峰会展示了一种["上游优先"(Moving Google toward the mainline)](https://lwn.net/Articles/871195)的方法, 以推动新的内核功能. 追求"新功能的上游优先开发模型", 以确保新代码首先进入主线Linux内核, 而不是直接在Android源代码树中停留. + +谷歌的 Todd Kjos 随后在 Linux Plumbers Conference(LPC2021) 上谈到了他们的[通用内核映像(Generic Kernel Image, GKI)计划](https://linuxplumbersconf.org/event/11/contributions/1046). 通过 Android 12 和他们基于 Linux 5.10 的 GKI 映像, 进一步减少了碎片化, 以至于"几乎被消除". 在 Android 12 GKI 中, 大多数供应商/OEM 内核功能现在要么被上游到 Linux 内核中, 要么被隔离到供应商模块或者钩子中, 要么合并到 Android Common Kernel 中. + +LWN 上也对此进行了[汇总报道](https://lwn.net/Kernel/Index/#Android-Generic_kernel_image) + +[Google Finally Shifting To "Upstream First" Linux Kernel Approach For Android Features](https://www.phoronix.com/scan.php?page=news_item&px=Android-Linux-Upstream-First) + +[Android to take an “upstream first” development model for the Linux kernel](https://arstechnica.com/gadgets/2021/09/android-to-take-an-upstream-first-development-model-for-the-linux-kernel) + +[](https://stackoverflow.com/questions/65415511/android-kernel-build-flow-with-gki-introduced-from-android-11) + +[LPC 2021-Generic Kernel Image](https://linuxplumbersconf.org/event/11/contributions/1046/attachments/824/1557/2021%20LPC%20GKI.pdf) + +目前的计划: + +1. 2020-2022: Accumulating ecosystem technical debt in Android Common Kernels (android12-5.10 and android-mainline), 汇总技术债务 + +2. 2023-2024: 减少技术债务(Reducing Technical Debt) + + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2020/04/24 | Todd Kjos | [ANDROID: add support for vendor hooks](https://lore.kernel.org/patchwork/patch/1394812) | 启动阶段异步解压 initramfs. 可以加速系统启动. | v1 ☑ [5.13-rc1](https://kernelnewbies.org/Linux_5.13) | [Patchwork 00/28](https://github.com/aosp-mirror/kernel_common/commit/67e0a3df19970176f093ff8be72f201d8c76ae81) | + # OTHER ------- @@ -549,6 +580,17 @@ https://patchwork.kernel.org/project/linux-trace-devel/list/?submitter=200911&st |:----:|:----:|:---:|:----:|:---------:|:----:| | 2021/12/18 | David Woodhouse | [lib/bitmap: optimize bitmap_weight() usage](https://patchwork.kernel.org/project/linux-mm/cover/20211218212014.1315894-1-yury.norov@gmail.com) | NA | v1 ☐ | [Patchwork v2,00/17](https://lkml.kernel.org/lkml/20211209150938.3518-1-dwmw2@infradead.org) | + +## 18.2 CONFIG +------- + + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2021/12/18 | David Woodhouse | [configs: introduce debug.config for CI-like setup](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0aaa8977acbf3996d351f51b3b15295943092f63) | 参见 [Linux 5.17 Making It Easier To Build A Kernel With All The Shiny Debug Features](https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.17-debug-config) | v5 ☑ 5.17-rc1 | [Patchwork v5](https://lore.kernel.org/all/20211115134754.7334-1-quic_qiancai@quicinc.com) | + + +
* 本作品/博文 ( [AderStep-紫夜阑珊-青伶巷草 Copyright ©2013-2017](http://blog.csdn.net/gatieme) ), 由 [成坚(gatieme)](http://blog.csdn.net/gatieme) 创作. diff --git a/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md b/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md index 3b90ad1..eb7f3ab 100644 --- a/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md +++ b/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md @@ -289,7 +289,17 @@ Linux 一开始是在一台i386上的机器开发的, i386 的硬件页表是2 | 2021/07/19 | "Matthew Wilcox (Oracle)" | [Folio support in block + iomap layers](https://lwn.net/Articles/1450196) | NA | v15 ☐ | [PatchWork v15,00/17](https://patchwork.kernel.org/project/linux-mm/cover/20210712194551.91920-1-willy@infradead.org/) | | 2021/07/15 | "Matthew Wilcox (Oracle)" | [Memory folios: Pagecache edition](https://patchwork.kernel.org/project/linux-mm/cover/20210715200030.899216-1-willy@infradead.org) | NA | v14c ☑ 5.16-rc1 | [PatchWork v14c,00/39](https://patchwork.kernel.org/project/linux-mm/cover/20210715200030.899216-1-willy@infradead.org) | | 2021/11/10 | David Howells | [netfs, 9p, afs, ceph: Support folios, at least partially](https://www.phoronix.com/scan.php?page=news_item&px=AFS-9p-NETFS-Folios-Linux-5.16) | NA | v5 ☑ 5.16-rc1 | [PatchWork v4,0/5](https://patchwork.kernel.org/project/linux-mm/cover/163649323416.309189.4637503793406396694.stgit@warthog.procyon.org.uk)
*-*-*-*-*-*-*-*
[PatchWork v5,0/4](https://patchwork.kernel.org/project/linux-mm/cover/163657847613.834781.7923681076643317435.stgit@warthog.procyon.org.uk)
*-*-*-*-*-*-*-*
[Merge tag](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f7ddea6225b9b001966bc9665924f1f8b9ac535) | -| 2022/01/02 | "Matthew Wilcox (Oracle)" | [MConvert GUP to folios](https://patchwork.kernel.org/project/linux-mm/cover/20220102215729.2943705-1-willy@infradead.org) | NA | v1 ☐ | [PatchWork 00/17](https://patchwork.kernel.org/project/linux-mm/cover/20220102215729.2943705-1-willy@infradead.org) | +| 2022/01/10 | "Matthew Wilcox (Oracle)" | [Convert GUP to folios](https://patchwork.kernel.org/project/linux-mm/cover/20220102215729.2943705-1-willy@infradead.org) | NA | v1 ☐ | [PatchWork 00/17](https://patchwork.kernel.org/project/linux-mm/cover/20220102215729.2943705-1-willy@infradead.org)
*-*-*-*-*-*-*-*
[PatchWork v2,00/28](https://patchwork.kernel.org/project/linux-mm/cover/20220110042406.499429-1-willy@infradead.org) | +| 2022/01/05 | Alex Shi | [remove add/del page to lru functions](https://patchwork.kernel.org/project/linux-mm/cover/20220120131024.502877-1-alexs@kernel.org) | 使用了 folio 之后, LRU 后部分函数可以删除. | v1 ☐ | [PatchWork 0/5](https://patchwork.kernel.org/project/linux-mm/cover/20220120131024.502877-1-alexs@kernel.org) | + + +[Folio Improvements For Linux 5.17, Large Folio Patches Posted](https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.17-Folios) + + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2021/10/08 | "Matthew Wilcox (Oracle)" | [Folios for 5.17](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=6b24ca4a1a8d4ee3221d6d44ddbb99f542e4bda3) | 将大部分 Page Cache 转换为使用 folios. 其中最大的变化是[在页面缓存 XArray 中使用大型条目](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6b24ca4a1a8d4ee3221d6d44ddbb99f542e4bda3), 而不是许多小型条目. 目前, 这只会影响到 shmem, 但对 shmem 来说, 这是一个相当大的变化, 因为[它改变了需要分配内存的位置](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b9a8a4195c7d3a51235a4fc974a46ad4e9689ffd)(在分割时而不是插入时). | v1 ☑ [5.17-rc1](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6020c204be997e3f5129839ff9c801800fb4336e) | [PatchWork 00/48](https://patchwork.kernel.org/project/linux-mm/cover/20211208042256.1923824-1-willy@infradead.org) | +| 2022/01/16 | "Matthew Wilcox (Oracle)" | [Enabling large folios for 5.17](https://patchwork.kernel.org/project/linux-mm/cover/20220116121822.1727633-1-willy@infradead.org/) | NA | v1 ☐ | [LKML 00/12](https://patchwork.kernel.org/project/linux-mm/cover/20220116121822.1727633-1-willy@infradead.org) | ### 1.4.2 Pulling slabs out of struct page @@ -4015,6 +4025,8 @@ KFENCE 的灵感来自于 [GWP-ASan](http://llvm.org/docs/GwpAsan.html), 这是 ### 13.4.4 数据访问监视器 DAMON ------- +[Software Visualizations to Analyze Memory Consumption: A Literature Review](https://dl.acm.org/doi/pdf/10.1145/3485134) + [linux data access monitor (DAMON)](https://blog.csdn.net/zqh1630/article/details/109954910) [LWN: 用DAMON来优化memory-management!](https://blog.csdn.net/Linux_Everything/article/details/104707923) @@ -4100,6 +4112,14 @@ DAMON 利用两个核心机制 : **基于区域的采样**和**自适应区域 | 2016/02/03 | Christian Borntraeger | [Optimize CONFIG_DEBUG_PAGEALLOC (x86 and s390)](https://damonitor.github.io) | 优化 CONFIG_DEBUG_PAGEALLOC, 提供了 debug_pagealloc_enabled(), 可以动态的开启 DEBUG_PAGEALLOC. | v4 ☑ 4.6-rc1 | [PatchWork v4,0/4](https://lore.kernel.org/patchwork/cover/642851) | +## 13.5 tracepoint +------- + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2016/02/19 | Paul Gortmaker | [mmap_lock: add tracepoints around lock acquisition](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=abedf8e2419fb873d919dd74de2e84b510259339) | mmap lock tracepoint | v9 ☑ 4.6-rc1 | [LKML v8,0/5](https://lore.kernel.org/all/20201105211739.568279-1-axelrasmussen@google.com) | +| 2022/01/07 | Anshuman Khandual | [mm/migration: Add trace events for THP migrations](https://patchwork.kernel.org/project/linux-mm/patch/1641531575-28524-1-git-send-email-anshuman.khandual@arm.com) | THP migrations tracepoint | v1 ☐ | [LORE v1](https://patchwork.kernel.org/project/linux-mm/patch/1641531575-28524-1-git-send-email-anshuman.khandual@arm.com) | + diff --git a/study/kernel/00-DESCRIPTION/SCHEDULER.md b/study/kernel/00-DESCRIPTION/SCHEDULER.md index 4cf700e..f6af433 100644 --- a/study/kernel/00-DESCRIPTION/SCHEDULER.md +++ b/study/kernel/00-DESCRIPTION/SCHEDULER.md @@ -2007,7 +2007,8 @@ PREEMPT-RT PATCH 的核心思想是最小化内核中不可抢占部分的代码 | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| | 2020/08/03 | Peter Oskolkov / | [FUTEX_SWAP](https://lore.kernel.org/patchwork/cover/1433967) | 通过对 futex 的魔改, 使得在用户态使用 switch_to() 指定任务切换的能力. 这就是用户模式线程的用途: 极低的切换开销, 意味着我们操作系统可以支持的数以千计的线程可以提高到 10 倍以上甚至百万级别. | [2020/06/15 PatchWork RFC,0/3](https://lore.kernel.org/patchwork/cover/1256264)
*-*-*-*-*-*-*-*
[2020/06/16 PatchWork RFC,0/3,v2](https://lore.kernel.org/patchwork/cover/1257233)
*-*-*-*-*-*-*-*
[2021/07/16 PatchWork RFC,0/3,v3](https://lore.kernel.org/patchwork/cover/1263506)
*-*-*-*-*-*-*-*
[2020/08/03 PatchWork for,5.9,v2,0/4](https://lore.kernel.org/patchwork/cover/1283798) | -| 2021/12/14 | Peter Oskolkov / | [sched,mm,x86/uaccess: implement User Managed Concurrency Groups](https://lore.kernel.org/patchwork/cover/1433967) | UMCG (User-Managed Concurrency Groups) | [PatchWork RFC,v0.1,0/9](https://lore.kernel.org/patchwork/cover/1433967)
*-*-*-*-*-*-*-*
[2021/07/08 PatchWork RFC,0/3,v0.2](https://lore.kernel.org/patchwork/cover/1455166)
*-*-*-*-*-*-*-*
[2021/07/16 PatchWork RFC,0/4,v0.3](https://lore.kernel.org/patchwork/cover/1461708)
*-*-*-*-*-*-*-*
[2021/08/01 PatchWork 0/4,v0.4](https://lore.kernel.org/patchwork/cover/1470650)
*-*-*-*-*-*-*-*
[2021/08/01 LWN 0/4,v0.5](https://lore.kernel.org/patchwork/cover/1470650)
*-*-*-*-*-*-*-*
[2021/10/12 PatchWork v0.7,0/5](https://patchwork.kernel.org/project/linux-mm/cover/20211012232522.714898-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/11/04 PatchWork v0.8,0/6](https://patchwork.kernel.org/project/linux-mm/cover/20211104195804.83240-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/11/21 PatchWork v0.9,0/6](https://patchwork.kernel.org/project/linux-mm/cover/20211121212040.8649-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/11/23 PatchWork v0.9.1,0/6](https://patchwork.kernel.org/project/linux-mm/cover/20211122211327.5931-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/12/14 PatchWork RFC,0/3](https://patchwork.kernel.org/project/linux-mm/cover/20211214204445.665580974@infradead.org) | +| 2021/12/14 | Peter Oskolkov / | [sched,mm,x86/uaccess: implement User Managed Concurrency Groups](https://lore.kernel.org/patchwork/cover/1433967) | UMCG (User-Managed Concurrency Groups) | [PatchWork RFC,v0.1,0/9](https://lore.kernel.org/patchwork/cover/1433967)
*-*-*-*-*-*-*-*
[2021/07/08 PatchWork RFC,0/3,v0.2](https://lore.kernel.org/patchwork/cover/1455166)
*-*-*-*-*-*-*-*
[2021/07/16 PatchWork RFC,0/4,v0.3](https://lore.kernel.org/patchwork/cover/1461708)
*-*-*-*-*-*-*-*
[2021/08/01 PatchWork 0/4,v0.4](https://lore.kernel.org/patchwork/cover/1470650)
*-*-*-*-*-*-*-*
[2021/08/01 LWN 0/4,v0.5](https://lore.kernel.org/patchwork/cover/1470650)
*-*-*-*-*-*-*-*
[2021/10/12 PatchWork v0.7,0/5](https://patchwork.kernel.org/project/linux-mm/cover/20211012232522.714898-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/11/04 PatchWork v0.8,0/6](https://patchwork.kernel.org/project/linux-mm/cover/20211104195804.83240-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/11/21 PatchWork v0.9,0/6](https://patchwork.kernel.org/project/linux-mm/cover/20211121212040.8649-1-posk@google.com)
*-*-*-*-*-*-*-*
[2021/11/23 PatchWork v0.9.1,0/6](https://patchwork.kernel.org/project/linux-mm/cover/20211122211327.5931-1-posk@google.com) | +| 2016/02/19 | Paul Gortmaker | [sched: User Managed Concurrency Groups](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?id=abedf8e2419fb873d919dd74de2e84b510259339) | 引入 hugetlb cgroup | v9 ☑ 4.6-rc1 | [PatchWork RFC,0/3](https://patchwork.kernel.org/project/linux-mm/cover/20211214204445.665580974@infradead.org)
*-*-*-*-*-*-*-*
[PatchWork RFC,v2,0/5](https://patchwork.kernel.org/project/linux-mm/cover/20220120155517.066795336@infradead.org) | | 2021/09/08 | Peter Oskolkov / | [google ghOSt](https://github.com/google/ghost-kernel) | ghOSt 是在 Linux 内核上实现的用户态调度策略的通用代理. ghOSt 框架提供了一个丰富的 API, 该 API 从用户空间接收进程的调度决策, 并将其作为事务执行. 程序员可以使用任何语言或工具来开发策略, 这些策略可以在不重新启动机器的情况下升级. ghOSt 支持一系列调度目标的策略, 从 µs 级延迟到吞吐量, 再到能源效率, 等等, 并且调度操作的开销较低. 许多策略只是几百行代码. 总之, ghOSt 提供了一个性能框架, 用于将线程调度策略委托给用户空间进程, 从而实现策略优化、无中断升级和故障隔离. | [github kernel](https://github.com/google/ghost-kernel)
*-*-*-*-*-*-*-*
[github userspace](https://github.com/google/ghost-userspace) | diff --git a/study/kernel/00-DESCRIPTION/TOOLS.md b/study/kernel/00-DESCRIPTION/TOOLS.md index e31e0de..8713daa 100644 --- a/study/kernel/00-DESCRIPTION/TOOLS.md +++ b/study/kernel/00-DESCRIPTION/TOOLS.md @@ -78,6 +78,11 @@ systrace, perfetto, drgn | 2019/05/29 | Sandoval @ Facebook | [A kernel debugger in Python: drgn](https://lwn.net/Articles/789641) | 一款 kernel 调试器, 可以利用 Python 脚本来访问正在运行的 kernel 里的数据结构
Drgn 在 [LSFMM2019](https://lwn.net/Articles/lsfmm2019) 被公开, LWN 随即进行了报道 [A kernel debugger in Python: drgn](https://lwn.net/Articles/789641), 随后 [2021 年报道](https://lwn.net/Articles/878309/)了 [drgn: How the Linux Kernel Team at Meta Debugs the Kernel at Scale (Meta)](https://developers.facebook.com/blog/post/2021/12/09/drgn-how-linux-kernel-team-meta-debugs-kernel-scale), Meta 的内核团队使用了 Drgn 跟踪内核中出现的问题, 并贡献了非常分布的用例集合. | ☐ | [Github](https://github.com/osandov/drgn), [User Guide](https://drgn.readthedocs.io/en/latest/user_guide.html), [BPF drgn tools](https://www.kernel.org/doc/html/latest/bpf/drgn.html) | | 2021/11/21 | David Woodhouse | [Microsoft-Performance-Tools-Linux-Android](https://www.phoronix.com/scan.php?page=news_item&px=MS-Performance-Tools-Linux) | Microsoft [发布了](https://devblogs.microsoft.com/performance-diagnostics/new-tools-for-analyzing-android-linux-and-chromium-browser-performance)一款 Linux/Android 的性能分析工具 [Performance Tools For Linux/Android](https://github.com/microsoft/Microsoft-Performance-Tools-Linux-Android), 一组跟踪处理工具, 它提供了许多强大的功能、功能、方法和生态系统, 这些功能、功能、方法和生态系统在过去 15 年多的时间里一直用于通过不断发展和更新的工具集来推动系统的性能. 支持通过 LTTng、perf 和 Perfetto 对系统进行分析. | v1 ☐ | [LWN](https://github.com/microsoft/Microsoft-Performance-Tools-Linux-Android) | +* DRGN + +[LWN/A kernel debugger in Python: drgn(https://lwn.net/Articles/789641) +[LWN: 想用python命令来调试kernel吗?drgn就是了!](https://blog.csdn.net/Linux_Everything/article/details/93270705) + ## 2.2 call kernel func from userspace -------