Documentation/translations/zh_CN/mm/physical_memory.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/mm/physical_memory.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/mm/physical_memory.rst- Extension
.rst- Size
- 13496 bytes
- Lines
- 357
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function for_each_online_node
Annotated Snippet
for_each_online_node(nid) {
pg_data_t *pgdat = NODE_DATA(nid);
foo(pgdat);
}
节点数据结构
------------
节点结构 ``struct pglist_data`` 在 ``include/linux/mmzone.h``
中声明。这里我们将简要描述这个结构体的字段:
通用字段
~~~~~~~~
``node_zones``
表示该节点的区域列表。并非所有区域都可能被填充,但这是
完整的列表。它被该节点的node_zonelists以及其它节点的
node_zonelists引用。
``node_zonelists``
表示所有节点中所有区域的列表。此列表定义了分配内存时首选的区域
顺序。``node_zonelists`` 在核心内存管理结构初始化期间,
由 ``mm/page_alloc.c`` 中的 ``build_zonelists()``
函数设置。
``nr_zones``
表示此节点中已填充区域的数量。
``node_mem_map``
对于使用FLATMEM内存模型的UMA系统,0号节点的 ``node_mem_map``
表示每个物理帧的struct pages数组。
``node_page_ext``
对于使用FLATMEM内存模型的UMA系统,0号节点的 ``node_page_ext``
是struct pages的扩展数组。只有在构建时开启了 ``CONFIG_PAGE_EXTENSION``
选项的内核中才可用。
``node_start_pfn``
表示此节点中起始页面帧的页面帧号。
``node_present_pages``
表示此节点中存在的物理页面的总数。
``node_spanned_pages``
表示包括空洞在内的物理页面范围的总大小。
``node_size_lock``
一个保护定义节点范围字段的锁。仅在开启了 ``CONFIG_MEMORY_HOTPLUG`` 或
``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` 配置选项中的某一个时才定义。提
供了 ``pgdat_resize_lock()`` 和 ``pgdat_resize_unlock()`` 用来操作
``node_size_lock``,而无需检查 ``CONFIG_MEMORY_HOTPLUG`` 或
``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` 选项。
``node_id``
节点的节点ID(NID),从0开始。
``totalreserve_pages``
这是每个节点保留的页面,这些页面不可用于用户空间分配。
``first_deferred_pfn``
如果大型机器上的内存初始化被推迟,那么第一个PFN(页帧号)是需要初始化的。
在开启了 ``CONFIG_DEFERRED_STRUCT_PAGE_INIT`` 选项时定义。
``deferred_split_queue``
每个节点的大页队列,这些大页的拆分被推迟了。仅在开启了 ``CONFIG_TRANSPARENT_HUGEPAGE``
配置选项时定义。
``__lruvec``
每个节点的lruvec持有LRU(最近最少使用)列表和相关参数。仅在禁用了内存
Annotation
- Detected declarations: `function for_each_online_node`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.