diff --git a/distro/OpenAnolis/README.md b/distro/OpenAnolis/README.md index ff1e636..02c5273 100755 --- a/distro/OpenAnolis/README.md +++ b/distro/OpenAnolis/README.md @@ -2,6 +2,8 @@ ===================== +# 总结 +------- - [x] [Alibaba Cloud Linux 2](https://help.aliyun.com/document_detail/154950.html) - [x] [Alibaba Cloud Linux 2功能和接口概述](https://help.aliyun.com/document_detail/177687.html) @@ -13,18 +15,18 @@ |:-------:|:----:| | 启用cgroup writeback功能 | Alibaba Cloud Linux 2在内核版本4.19.36-12.al7中,对内核接口cgroup v1新增了控制群组回写(cgroup writeback)功能. 该功能使您在使用内核接口cgroup v1时,可以对缓存异步I/O (Buffered I/O) 进行限速. | | blk-iocost权重限速 | Alibaba Cloud Linux 2在内核版本4.19.81-17.al7.x86_64开始支持基于成本模型(cost model)的权重限速功能,即blk-iocost功能. 该功能是对内核中IO子系统(blkcg)基于权重的磁盘限速功能的进一步完善. | -| 在cgroup v1接口开启PSI功能 | Alibaba Cloud Linux 2在内核版本4.19.81-17.al7中为cgroup v1接口提供了PSI功能. PSI(Pressure Stall Information)是一个可以监控CPU、内存及IO性能异常的内核功能. | -| 修改TCP TIME-WAIT超时时间 | 在Linux的内核中,TCP/IP协议的TIME-WAIT状态持续60秒且无法修改. 但在某些场景下,例如TCP负载过高时,适当调小该值有助于提升网络性能. 因此Alibaba Cloud Linux 2在内核版本4.19.43-13.al7新增内核接口,用于修改TCP TIME-WAIT超时时间. | -| Block IO限流增强监控接口 | 为了更方便地监控Linux block IO限流,Alibaba Cloud Linux 2在内核版本4.19.81-17.al7增加相关接口,用于增强block IO限流的监控统计能力. | -| JBD2优化接口 | JBD2作为ext4文件系统的内核线程,在使用过程中常会遇到影子状态(BH_Shadow),影响系统性能. 为解决使用JBD2过程中出现的异常,Alibaba Cloud Linux 2在内核版本4.19.81-17.al7对JBD2进行了优化. | +| 在 cgroup v1 接口开启 PSI 功能 | Alibaba Cloud Linux 2在内核版本4.19.81-17.al7中为cgroup v1接口提供了PSI功能. PSI(Pressure Stall Information)是一个可以监控CPU、内存及IO性能异常的内核功能. | +| 修改 TCP TIME-WAIT 超时时间 | 在Linux的内核中,TCP/IP协议的TIME-WAIT状态持续60秒且无法修改. 但在某些场景下,例如TCP负载过高时,适当调小该值有助于提升网络性能. 因此Alibaba Cloud Linux 2在内核版本4.19.43-13.al7新增内核接口,用于修改TCP TIME-WAIT超时时间. | +| Block IO 限流增强监控接口 | 为了更方便地监控Linux block IO限流,Alibaba Cloud Linux 2在内核版本4.19.81-17.al7增加相关接口,用于增强block IO限流的监控统计能力. | +| JBD2 优化接口 | JBD2作为ext4文件系统的内核线程,在使用过程中常会遇到影子状态(BH_Shadow),影响系统性能. 为解决使用JBD2过程中出现的异常,Alibaba Cloud Linux 2在内核版本4.19.81-17.al7对JBD2进行了优化. | | 跨目录配额创建硬链接 | 默认情况下,ext4文件系统中存在约束,不允许跨目录配额创建硬链接. 但在实际中,某些特定场景有创建硬链接的需求,因此Alibaba Cloud Linux 2提供定制接口,该接口能够绕过ext4文件系统中的约束,实现跨目录配额创建硬链接. | -| 追踪IO时延 | Alibaba Cloud Linux 2优化了IO时延分析工具iostat的原始数据来源/proc/diskstats接口,增加了对设备侧的读、写及特殊IO(discard)等耗时的统计,此外还提供了一个方便追踪IO时延的工具bcc. | -| 检测文件系统和块层的IO hang | IO hang是指在系统运行过程中,因某些IO耗时过长而引起的系统不稳定甚至宕机. 为了准确检测出IO hang,Alibaba Cloud Linux 2扩展核心数据结构,增加了在较小的系统开销下,快速定位并检测IO hang的功能. | -| Memcg全局最低水位线分级 | Alibaba Cloud Linux 2新增了memcg全局最低水位线分级功能. 在global wmark_min的基础上,将资源消耗型任务的global wmark_min上移,使其提前进入直接内存回收. 将时延敏感型业务的global wmark_min下移,使其尽量避免直接内存回收. 这样当资源消耗型任务瞬间申请大量内存的时候,会通过上移的global wmark_min将其短时间抑制,避免时延敏感型业务发生直接内存回收. 等待全局kswapd回收一定量的内存后,再解除资源消耗型任务的短时间抑制. | -| Memcg后台异步回收 | Alibaba Cloud Linux 2 增加了 memcg 粒度的后台异步回收功能. 该功能的实现不同于全局kswapd内核线程的实现,并没有创建对应的memcg kswapd内核线程,而是采用了workqueue机制来实现. | -| cgroup v1接口支持memcg QoS功能 | 内存子系统服务质量(memcg QoS)可以用来控制内存子系统(memcg)的内存使用量的保证(锁定)与限制. Alibaba Cloud Linux 2在4.19.91-18.al7内核版本,新增cgroup v1接口支持memcg QoS的相关功能. | -| Memcg Exstat功能 | Alibaba Cloud Linux 2在4.19.91-18.al7内核版本开始支持的Memcg Exstat(Extend/Extra)功能. | -| TCP-RT功能的配置说明 | Alibaba Cloud Linux 2在内核版本kernel-4.19.91-21.al7开始支持TCP层的服务监控功能(TCP-RT). | +| 追踪 I O时延 | Alibaba Cloud Linux 2优化了IO时延分析工具iostat的原始数据来源/proc/diskstats接口,增加了对设备侧的读、写及特殊IO(discard)等耗时的统计,此外还提供了一个方便追踪IO时延的工具bcc. | +| 检测文件系统和块层的 IO hang | IO hang是指在系统运行过程中,因某些IO耗时过长而引起的系统不稳定甚至宕机. 为了准确检测出IO hang,Alibaba Cloud Linux 2扩展核心数据结构,增加了在较小的系统开销下,快速定位并检测IO hang的功能. | +| Memcg 全局最低水位线分级 | Alibaba Cloud Linux 2新增了memcg全局最低水位线分级功能. 在global wmark_min的基础上,将资源消耗型任务的global wmark_min上移,使其提前进入直接内存回收. 将时延敏感型业务的global wmark_min下移,使其尽量避免直接内存回收. 这样当资源消耗型任务瞬间申请大量内存的时候,会通过上移的global wmark_min将其短时间抑制,避免时延敏感型业务发生直接内存回收. 等待全局kswapd回收一定量的内存后,再解除资源消耗型任务的短时间抑制. | +| Memcg 后台异步回收 | Alibaba Cloud Linux 2 增加了 memcg 粒度的后台异步回收功能. 该功能的实现不同于全局kswapd内核线程的实现,并没有创建对应的memcg kswapd内核线程,而是采用了workqueue机制来实现. | +| cgroup v1 接口支持memcg Qo S功能 | 内存子系统服务质量(memcg QoS)可以用来控制内存子系统(memcg)的内存使用量的保证(锁定)与限制. Alibaba Cloud Linux 2在4.19.91-18.al7内核版本,新增cgroup v1接口支持memcg QoS的相关功能. | +| Memcg Exstat 功能 | Alibaba Cloud Linux 2 在4.19.91-18.al7内核版本开始支持的Memcg Exstat(Extend/Extra)功能. | +| TCP-RT 功能的配置说明 | Alibaba Cloud Linux 2在内核版本kernel-4.19.91-21.al7开始支持TCP层的服务监控功能(TCP-RT). | # 1 SCHEDULER @@ -63,6 +65,8 @@ cpuacct 中引入了一些调度相关的 latency 的统计信息, 并用 histog ```cpp +252315eb68be alinux: sched: get_sched_lat_count_idx optimization + ab81d2d9f745 alinux: sched: Add cpu_stress to show system-wide task waiting c7462cfec178 alinux: sched: Fix wrong cpuacct_update_latency declaration @@ -122,7 +126,7 @@ bae5297970bb sched/fair: Disable LB_BIAS by default -## 1.5 PSI +## 1.5 PSI(Tracking pressure-stall information) ------- ### 1.5.1 PSI V1 @@ -140,9 +144,13 @@ eee77c97f8c4 sched/psi: Correct overly pessimistic size calculation a4a4fdd978a8 sched/psi: Reduce psimon FIFO priority ``` -### 1.5.2 PSI V2 +### 1.5.2 PSI core ------- +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2019/03/19 | Johannes Weiner | [psi: pressure stall monitors v6](https://lore.kernel.org/patchwork/patch/1052413) | NA | v6 ☑ [5.2-rc1](https://kernelnewbies.org/Linux_5.2) | [Patchwork](https://lore.kernel.org/patchwork/patch/1052413) | + ```cpp c1cc09981b82 psi: introduce psi monitor a77db4849800 kernel: cgroup: add poll file operation @@ -153,6 +161,11 @@ a310bf88c601 psi: track changed states 6c479dfbe22f psi: rename psi fields in preparation for psi trigger addition b967851710f2 psi: make psi_enable static 529aca9e758a psi: introduce state_mask to represent stalled psi states +``` + + +```cpp +https://lore.kernel.org/patchwork/patch/1057457/ 92f5c2aec4ce psi: clarify the units used in pressure files 2ab1c71c198d psi: avoid divide-by-zero crash inside virtual machines c3a04b34efeb psi: clarify the Kconfig text for the default-disable option @@ -160,13 +173,11 @@ c3a04b34efeb psi: clarify the Kconfig text for the default-disable option bcc32a75cf6b psi: fix reference to kernel commandline enable 8570f9337114 psi: make disabling/enabling easier for vendor kernels d09e62bab8d0 kernel/sched/psi.c: simplify cgroup_move_task() -d26da1947f48 psi: cgroup support -8b2bf0799111 psi: pressure stall information for CPU, memory, and IO ``` | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| -| 2020/04/03 | Johannes Weiner | [psi: pressure stall information for CPU, memory, and IO v4](https://lwn.net/Articles/815342) | NA | v4 ☑ [4.20-rc1](https://kernelnewbies.org/Linux_5.9#Memory_management) | [Patchwork](https://lore.kernel.org/patchwork/patch/978495) | +| 2018/08/28 | Johannes Weiner | [psi: pressure stall information for CPU, memory, and IO v4](https://lwn.net/Articles/759781) | 引入 PSI 评估系统 CPU, MEMORY, IO 等资源的压力. | v4 ☑ [4.20-rc1](https://kernelnewbies.org/Linux_5.9#Memory_management) | [Patchwork](https://lore.kernel.org/patchwork/patch/978495) | ```cpp d26da1947f48 psi: cgroup support @@ -180,13 +191,6 @@ ec035638f0c2 sched: introduce this_rq_lock_irq() -```cpp -abd7f977069d alinux: sched: Fix a branch prediction error in static_key -a66f5804aa67 alinux: sched: Fix compiling error without CONFIG_FAIR_GROUP_SCHED -252315eb68be alinux: sched: get_sched_lat_count_idx optimization -``` - - ## 1.6 burst ------- @@ -416,11 +420,9 @@ f2116b7f9274 mm/workingset: remove unused @mapping argument in workingset_evicti 54c1b36ed43a mm/memcontrol: update lruvec counters in mem_cgroup_move_account ``` -## 2.5 task #3047633(enhance & fix memcg) +## 2.5 task #3047633(enhance memcg statistic) ------- - - ### 2.5.1 fix ------- @@ -453,12 +455,12 @@ c24d85c9806d mm: memcontrol: make cgroup stats and events query API explicitly l 98ab53a614a mm, memcg: rename ambiguously named memory.stat counters and functions ``` -### 2.5.3 mm: memcontrol: track LRU counts in the vmstats array +### 2.5.3 mm: memcontrol: clean up the LRU counts tracking ------- | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:---:|:----------:|:----:| -| 2019/02/28 | Johannes Weiner | [mm: memcontrol: track LRU counts in the vmstats array](https://lore.kernel.org/patchwork/cover/1046756) | NA | v1 ☑ [5.2-rc1](https://kernelnewbies.org/Linux_5.2#Memory_management) | [PatchWork v2](https://lore.kernel.org/patchwork/cover/1046756) | +| 2019/02/28 | Johannes Weiner | [mm: memcontrol: clean up the LRU counts tracking](https://lore.kernel.org/patchwork/cover/1046756) | NA | v1 ☑ [5.2-rc1](https://kernelnewbies.org/Linux_5.2#Memory_management) | [PatchWork v2](https://lore.kernel.org/patchwork/cover/1046756) | ```cpp https://lore.kernel.org/patchwork/patch/1046756 @@ -471,7 +473,7 @@ af2a43b06ab6 mm: memcontrol: track LRU counts in the vmstats array ``` -## 2.6 task #30476868 +## 2.6 task #30476868(mm: memcontrol: charge swapin pages on instantiation) ------- ### 2.6.1 NA @@ -584,7 +586,7 @@ efe4ee97dd8f mm, memcg: fix corruption on 64-bit divisor in memory.high throttli -## 2.9 MEMSLI(to #26424368) +## 2.8 MEMSLI(to #26424368) ------- ```cpp @@ -595,6 +597,15 @@ mkdir -p /sys/fs/cgroup/memory mount -t cgroup -o memory memory /sys/fs/cgroup/memory ``` + + + +cpuacct 中引入了一些调度相关的 latency 的统计信息, 并用 histograms 的方式输出. + +| 接口 | 描述 | 实现思路 | commit | +|:---:|:----:|:-------:|:-------:| +| memory.{direct_reclaim_global_latency,direct_reclaim_memcg_latency} | 全局直接回收 和 memcg直接回收的延迟 | 统计方式同 psi_memstall 等计数器. enqueue_entity 入队时开始计时, 出队时结束计时(set_next_entity 准备投入运行时, 也会出队.) | [83058e75601e alinux: mm, memcg: record latency of direct reclaim in every memcg](https://github.com/alibaba/cloud-kernel/commit/83058e75601ebc28df0f4ddfd344b8926bf5c178) | + ```cpp start_commit : 3d5ca29dd634b4628d7dc82423b2680718e6eb2a end_commit : a5f32c14829c2cf52ffe8a2c25fd5e089c254d9c @@ -613,7 +624,7 @@ fe673ccf92aa alinux: mm, memcg: adjust the latency probe point for memcg direct 83058e75601e alinux: mm, memcg: record latency of direct reclaim in every memcg ``` -## 2.10 to #28825456(Fragmentation avoidance improvements v5) +## 2.9 to #28825456(Fragmentation avoidance improvements v5) ------- | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | @@ -639,7 +650,7 @@ fd98e14a7fb4 mm: use alloc_flags to record if kswapd can wake 039531d219fb mm, page_alloc: spread allocations across zones before introducing fragmentation ``` -## 2.11 to #28718400(mm: zap pages with read mmap_sem in munmap for large mapping) +## 2.10 to #28718400(mm: zap pages with read mmap_sem in munmap for large mapping) ------- | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | @@ -660,7 +671,7 @@ d33d61675b4d filemap: kill page_cache_read usage in filemap_fault 7027c30559b9 mm: mmap: zap pages with read mmap_sem in munmap ``` -## 2.12 task #27327988(thp/khugepaged improvements and CoW semantics) +## 2.11 task #27327988(thp/khugepaged improvements and CoW semantics) ------- @@ -686,7 +697,7 @@ ed3a7ca76842 khugepaged: do not stop collapse if less than half PTEs are referen -## 2.13 to #26255339(Increase success rates and reduce latency of compaction v3) +## 2.12 to #26255339(Increase success rates and reduce latency of compaction v3) ------- | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | @@ -740,7 +751,7 @@ b725e2580207 alinux: Revert "mm/compaction.c: clear total_{migrate,free}_scanned ``` -## 2.14 memcg QoS +## 2.13 memcg QoS ------- OOM 优先级以及水线控制 @@ -770,7 +781,7 @@ ef467b9ddbc0 alinux: memcg: Account throttled time due to memory.wmark_min_adj 63442ea9f838 alinux: memcg: Provide users the ability to reap zombie memcgs ``` -## 2.15 Introduce MADV_COLD and MADV_PAGEOUT +## 2.14 Introduce MADV_COLD and MADV_PAGEOUT ------- @@ -789,7 +800,7 @@ a0747c913cc3 mm: change PAGEREF_RECLAIM_CLEAN with PAGE_REFRECLAIM -## 2.16 Deferred page init improvements +## 2.15 Deferred page init improvements ------- | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | @@ -810,7 +821,7 @@ e23b0cb5fbb8 mm: use mm_zero_struct_page from SPARC on all 64b architectures ``` -## 2.17 CGROUP V1 ENHANCE +## 2.16 CGROUP V1 ENHANCE ------- 引入 workingset 统计 @@ -833,7 +844,7 @@ de7ca7468c5d mm, memcg: introduce memory.events.local ``` -## 2.18 Devmap cleanups + arm64 support +## 2.17 Devmap cleanups + arm64 support ------- | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | @@ -847,7 +858,25 @@ f72a099beb96 arm64: mm: add missing PTE_SPECIAL in pte_mkdevmap on arm64 d7066a918302 mm: introduce ARCH_HAS_PTE_DEVMAP ``` -## 2.19 background reclaim + +## 2.18 Make deferred split shrinker memcg aware +------- + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2019/06/12 | Yang Shi | [Make deferred split shrinker memcg aware](https://lore.kernel.org/patchwork/cover/1088698) | NA | v3 ☑ 5.4-rc1 | [PatchWork v3](https://lore.kernel.org/patchwork/cover/1088698) | + + +```cpp +dff2d64b00bc alinux: mm/thp: remove unused variable 'pgdata' in split_huge_page_to_list() +e6ca020bc338 alinux: mm: thp: move deferred split queue to memcg's nodeinfo +d651fcbb412a mm: thp: make deferred split shrinker memcg aware +bd5596b4a854 mm: shrinker: make shrinker not depend on memcg kmem +9b78918c7450 mm: move mem_cgroup_uncharge out of __page_cache_release() +e65b696142fc mm: thp: extract split_queue_* into a struct +``` + +## 2.19 background reclaim ------- diff --git a/study/kernel/00-DESCRIPTION/DEBUGGING.md b/study/kernel/00-DESCRIPTION/DEBUGGING.md index 3468978..984caf7 100644 --- a/study/kernel/00-DESCRIPTION/DEBUGGING.md +++ b/study/kernel/00-DESCRIPTION/DEBUGGING.md @@ -167,6 +167,26 @@ Date: Tue Feb 21 16:09:33 2017 +0100 |:----:|:----:|:---:|:----:|:---------:|:----:| | 2019/11/21 | Will Deacon | [Rework REFCOUNT_FULL using atomic_fetch_* operations](https://lore.kernel.org/patchwork/cover/1156945) | 通过 atomic_fetch_* 操作来降低 cmpxchg() 带来的性能开销, 从而提升 refcount 机制的性能. | v4 ☑ [5.5-rc1]() | [PatchWork](https://lore.kernel.org/patchwork/cover/1156945) | + +# 6 PSI +------- + + +Pressure Stall Information 提供了一种评估系统资源压力的方法。系统有三个基础资源:CPU、Memory 和 IO,无论这些资源配置如何增加,似乎永远无法满足软件的需求。一旦产生资源竞争,就有可能带来延迟增大,使用户体验到卡顿。 + +如果没有一种相对准确的方法检测系统的资源压力程度,有两种后果。一种是资源使用者过度克制,没有充分使用系统资源;另一种是经常产生资源竞争,过度使用资源导致等待延迟过大。准确的检测方法可以帮忙资源使用者确定合适的工作量,同时也可以帮助系统制定高效的资源调度策略,最大化利用系统资源,最大化改善用户体验。 + +Facebook 在 2018 年开源了一套解决重要计算集群管理问题的 Linux 内核组件和相关工具,PSI 是其中重要的资源度量工具,它提供了一种实时检测系统资源竞争程度的方法,以竞争等待时间的方式呈现,简单而准确地供用户以及资源调度者进行决策。 + +[纯干货,PSI 原理解析与应用](https://blog.csdn.net/feelabclihu/article/details/105534140) + + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2018/08/28 | Johannes Weiner | [psi: pressure stall information for CPU, memory, and IO v4](https://lwn.net/Articles/759781) | 引入 PSI 评估系统 CPU, MEMORY, IO 等资源的压力. | v4 ☑ [4.20-rc1](https://kernelnewbies.org/Linux_4.20#Core_.28various.29) | [Patchwork](https://lore.kernel.org/patchwork/patch/978495) | +| 2019/03/19 | Suren Baghdasaryan | [psi: pressure stall monitors v6](https://lwn.net/Articles/775971/) | NA | v6 ☑ [5.2-rc1](https://kernelnewbies.org/Linux_5.2#Improved_Presure_Stall_Information_for_better_resource_monitoring) | [Patchwork](https://lore.kernel.org/patchwork/patch/1052413) | + +
* 本作品/博文 ( [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 c0c0b42..eb91868 100644 --- a/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md +++ b/study/kernel/00-DESCRIPTION/MEMORY_MANAGER.md @@ -125,6 +125,7 @@ | 2018/07/09 | [Improve shrink_slab() scalability (old complexity was O(n^2), new is O(n))](http://lore.kernel.org/patchwork/patch/960597) | 内存镜像的功能 | RFC v2 ☐ | [PatchWork](https://lore.kernel.org/patchwork/patch/960597) | | 2020/02/24 | [Fine grained MM locking](https://patchwork.kernel.org/project/linux-mm/cover/20200224203057.162467-1-walken@google.com) | MM lockless | RFC ☐ | [PatchWork](https://patchwork.kernel.org/project/linux-mm/cover/20200224203057.162467-1-walken@google.com), [fine_grained_mm.pdf](https://linuxplumbersconf.org/event/4/contributions/556/attachments/304/509/fine_grained_mm.pdf) | + 社区的内存开发者 [David Rientjes ](https://lore.kernel.org/patchwork/project/lkml/list/?submitter=6580&state=*&archive=both¶m=4&page=1) @@ -1156,12 +1157,31 @@ https://lore.kernel.org/patchwork/cover/1118785 ### 2.8.2 缺页异常 ------- +#### 2.8.2.1 enhance +------- + | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| | 2015/09/10 | Catalin Marinas | [arm64: Add support for hardware updates of the access and dirty pte bits](https://patchwork.kernel.org/project/linux-arm-kernel/patch/1436545468-1549-1-git-send-email-catalin.marinas@arm.com) | ARMv8.1 体系结构扩展引入了对页表项中访问和脏信息的硬件更新的支持, 用于支持硬件自动原子地完成页表更新("读-修改-回写").
TCR_EL1.HA 为 1, 则使能硬件的自动更新访问位. 当处理器访问内存地址时, 硬件自动设置 PTE_AF 位, 而不是再触发访问位标志错误.
TCR_EL1.HD 为 1, 则使能硬件的脏位管理. | v1 ☑ [4.3-rc1](https://kernelnewbies.org/Linux_4.3#Architectures) | [PatchWork RFC](https://lore.kernel.org/patchwork/cover/344775)
*-*-*-*-*-*-*-*
[PatchWork](https://lore.kernel.org/patchwork/cover/344816), [commit 2f4b829c625e](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2f4b829c625ec36c2d80bef6395c7b74cea8aac0) | | 2017/07/25 | Catalin Marinas | [arm64: Fix potential race with hardware DBM in ptep_set_access_flags()](https://patchwork.kernel.org/project/linux-arm-kernel/patch/20170725135308.18173-2-catalin.marinas@arm.com) | 修复前面支持 TCP_EL1.HA/HD 引入的硬件和软件的竞争问题 | RFC ☐ | [PatchWork RFC](https://patchwork.kernel.org/project/linux-mm/cover/20200224203057.162467-1-walken@google.com) | +#### 2.8.2.2 MMAP locing +------- + +[The LRU lock and mmap_sem](https://lwn.net/Articles/753058) + +https://events.static.linuxfound.org/sites/events/files/slides/mm.pdf + +* SPF + +| 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | +|:----:|:----:|:---:|:----:|:---------:|:----:| +| 2018/05/17 | Laurent Dufour | [Speculative page faults](http://lore.kernel.org/patchwork/patch/906210) | SPF | v11 ☐ | [PatchWork](https://lore.kernel.org/patchwork/patch/906210) | +| 2021/04/20 | Michel Lespinasse | [Speculative page faults (anon vmas only)](http://lore.kernel.org/patchwork/patch/1420569) | SPF | v11 ☐ | [PatchWork RFC,00/37](https://lore.kernel.org/patchwork/cover/1408784)
*-*-*-*-*-*-*-*
[PatchWork v1](https://lore.kernel.org/patchwork/patch/1420569) | + + + ## 2.8.3 反向映射 RMAP(Reverse Mapping) ------- @@ -1343,7 +1363,8 @@ git://github.com/glommer/linux.git kmemcg-slab | 2012/10/19 | Glauber Costa | [kmemcg-stack](https://lwn.net/Articles/485593) | memcg 支持对内核 SLAB 进行统计 | v5 ☐ | [PatchWork v5](https://lore.kernel.org/patchwork/cover/334479) | | 2020/06/23 | Glauber Costa | [kmem controller for memcg](https://lwn.net/Articles/516529) | memcg 支持对内核内存(kmem)进行统计, memcg 开始支持统计两种类型的内核内存使用 : 内核栈 和 slab. 这些限制对于防止 fork 炸弹(bombs)等事件很有用. | v6 ☑ 3.8-rc1 | [PatchWork v5 kmem(stack) controller for memcg](https://lore.kernel.org/patchwork/cover/333535), [PatchWork v5 slab accounting for memcg](https://lore.kernel.org/patchwork/cover/334479/)
*-*-*-*-*-*-*-*
[PatchWork v6](https://lore.kernel.org/patchwork/cover/337780) | | 2020/06/23 | Roman Gushchin | [The new cgroup slab memory controller](https://lore.kernel.org/patchwork/cover/1261793) | 将 SLAB 的统计跟踪统计从页面级别更改为到对象级别. 它允许在 memory cgroup 之间共享 SLAB 页. 这一变化消除了每个 memory cgroup 每个重复的每个 cpu 和每个节点 slab 缓存集, 并为所有内存控制组建立了一个共同的每个cpu和每个节点slab缓存集. 这将显著提高 SLAB 利用率(最高可达45%), 并相应降低总的内核内存占用. 测试发现不可移动页面数量的减少也对内存碎片产生积极的影响. | v7 ☑ 5.9-rc1 | [PatchWork v7](https://lore.kernel.org/patchwork/cover/1261793/) | -| 2015/11/10 | Roman Gushchin | [memcg/kmem: switch to white list policy](https://lore.kernel.org/patchwork/cover/616606) | 所有的 kmem 分配(即每次 kmem_cache_alloc、kmalloc、alloc_kmem_pages调用)都会自动计入内存 cgroup. 如果出于某些原因, 呼叫者必须明确选择退出. 这样的设计决策会导致以下许多个问题, 因此该补丁切换为白名单策略. 现在 kmalloc 用户必须通过传递 __GFP_ACCOUNT 标志来显式标记. | v7 ☑ 5.9-rc1 | [PatchWork v7](https://lore.kernel.org/patchwork/cover/616606) | +| 2015/11/10 | Roman Gushchin | [memcg/kmem: switch to white list policy](https://lore.kernel.org/patchwork/cover/616606) | 所有的 kmem 分配(即每次 kmem_cache_alloc、kmalloc、alloc_kmem_pages调用)都会自动计入内存 cgroup. 如果出于某些原因, 呼叫者必须明确选择退出. 这样的设计决策会导致以下许多个问题, 因此该补丁切换为白名单策略. 现在 kmalloc 用户必须通过传递 __GFP_ACCOUNT 标志来显式标记. | v7 ☑ 5.9-rc1 | [PatchWork v7](https://lore.kernel.org/patchwork/cover/616606) | +| 2021/05/06 | Waiman Long | [mm/memcg: Reduce kmemcache memory accounting overhead](https://lore.kernel.org/patchwork/cover/1422112) | 降低 kmemcache 统计的消耗. | v6 ☐ | [PatchWork v6](https://lore.kernel.org/patchwork/cover/1422112) | ## 2.9.4 memcg LRU list @@ -1859,7 +1880,8 @@ DAMON 利用两个核心机制 : **基于区域的采样**和**自适应区域 | 时间 | 作者 | 特性 | 描述 | 是否合入主线 | 链接 | |:----:|:----:|:---:|:----:|:---------:|:----:| -| 2021/02/04 | SeongJae Park | [Introduce Data Access MONitor (DAMON)](https://damonitor.github.io) | 数据访问监视器 DAMON | v24 ☐ | [PatchWork v24](https://lore.kernel.org/patchwork/cover/1375732), [LWN](https://lwn.net/Articles/812707) | +| 2021/05/20 | SeongJae Park | [Introduce Data Access MONitor (DAMON)](https://damonitor.github.io) | 数据访问监视器 DAMON | v29 ☐ | [PatchWork v29](https://lore.kernel.org/patchwork/cover/1375732), [LWN](https://lwn.net/Articles/1432223) | +| 2021/05/31 | SeongJae Park | [Introduce DAMON-based Proactive Reclamation](https://damonitor.github.io) | 该补丁集改进了用于生产质量的通用数据访问模式内存管理的引擎, 并在其之上实现了主动回收. | RFC ☐ | [PatchWork RFC](https://lore.kernel.org/patchwork/cover/1375732) | # 2.14 杂项 diff --git a/study/kernel/07-sync/00-code/02-spinlock/Makefile b/study/kernel/07-sync/00-code/02-spinlock/Makefile new file mode 100644 index 0000000..dd6b061 --- /dev/null +++ b/study/kernel/07-sync/00-code/02-spinlock/Makefile @@ -0,0 +1,80 @@ +# ------------------------------------------------------------------------------ +# +# Makefile for the LDD-LinuxDeviceDrivers. +# +# Author: gatieme +# Create: 2016-07-29 15:50:46 +# Last modified: 2016-07-29 16:10:29 +# Description: +# This program is loaded as a kernel(v2.6.18 or later) module. +# Use "make install" to load it into kernel. +# Use "make remove" to remove the module out of kernel. +# +# ------------------------------------------------------------------------------ + + +ROOT=.. +#PLATFORM=$(shell $(ROOT)/systype.sh) +#include $(ROOT)/Make.defines.$(PLATFORM) + +# my driver description +DRIVER_VERSION := "1.0.0" +DRIVER_AUTHOR := "Gatieme @ AderStep Inc..." +DRIVER_DESC := "Linux input module for Elo MultiTouch(MT) devices" +DRIVER_LICENSE := "Dual BSD/GPL" + + +MODULE_NAME := hello +#MODCFLAGS:=-O2 -Wall -DMODULE -D__KERNEL__ -DLINUX -std=c99 +#EXTRA_CFLAGS += $(MODULE_FLAGS) $(CFG_INC) $(CFG_INC) + + + +ifneq ($(KERNELRELEASE),) # kernelspace + +obj-m := $(MODULE_NAME).o + +else # userspace + + +CURRENT_PATH ?= $(shell pwd) +LINUX_KERNEL ?= $(shell uname -r) +LINUX_KERNEL_PATH ?= /lib/modules/$(LINUX_KERNEL)/build + +CURRENT_PATH := $(shell pwd) + +modules: + make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules + +modules_install: + make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules_install + + + +insmod: + sudo insmod $(MODULE_NAME).ko + +reinsmod: + sudo rmmod $(MODULE_NAME) + sudo insmod $(MODULE_NAME).ko + +github: + cd $(ROOT) && make github + +rmmod: + sudo rmmod $(MODULE_NAME) + +test : + sudo ../injector/memInjector -l stack -m random -t word_0 --time 1 --timeout 3 -p 1 + +clean: + make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean + rm -f modules.order Module.symvers Module.markers + +.PHNOY: + modules modules_install clean + + + +endif + diff --git a/study/kernel/07-sync/00-code/02-spinlock/hello.c b/study/kernel/07-sync/00-code/02-spinlock/hello.c new file mode 100644 index 0000000..8453aa6 --- /dev/null +++ b/study/kernel/07-sync/00-code/02-spinlock/hello.c @@ -0,0 +1,52 @@ +#include +#include +#include +#include +#include +#include +//#include +//#include +//#include + + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Gatieme"); +MODULE_DESCRIPTION("test atomic_t"); + + +atomic_t count = ATOMIC_INIT(1); + + +static int hello_init(void) +{ + printk("init : %d\n", atomic_read(&count)); + + atomic_set(&count, 2); + printk("set2 : %d\n", atomic_read(&count)); + + atomic_add(3, &count); + printk("add3 : %d\n", atomic_read(&count)); + + atomic_sub(3, &count); + printk("sub3 : %d\n", atomic_read(&count)); + + + atomic_inc(&count); + printk("inc : %d\n", atomic_read(&count)); + + atomic_dec(&count); + printk("dev : %d\n", atomic_read(&count)); + + return 0; +} + + + +static void hello_exit(void) +{ + printk(KERN_ERR"exit"); +} + + +module_init(hello_init); +module_exit(hello_exit);