v21 2026-09-04

RSS分层percpu计数器 · v21

v21 用 hierarchical per-cpu counters 改进 RSS 统计/proc 近似,包含 mm_struct 布局与启动顺序修复。

原始补丁链接

子 Patch(6)

1/6
lib: introduce hierarchical per-cpu counters
This series introduces the hierarchical tree counter (hpcc) to increase accuracy of approximated RSS counters exposed through proc interfaces. With a test program hopping across CPUs doing frequent m
2/6
lib: test hierarchical per-cpu counters
Introduce Kunit tests for hierarchical per-cpu counters. Keep track of two sets of hierarchical counters, each meant to have the same precise sum at any time, but distributed differently across the t
3/6
mm: improve RSS counter approximation accuracy for proc interfaces
Use hierarchical per-cpu counters for RSS tracking to improve the accuracy of per-mm RSS sum approximation on large many-core systems [1]. This improves the accuracy of the RSS values returned by pro
4/6
mm: reorder mm_struct flexible array to place mm_cpumask first
Reorder the mm_struct flexible array layout from: [HPCC tree items][mm_cpumask][mm_cid] to: [mm_cpumask][mm_cid][alignment padding][HPCC tree items] The previous layout placed the HPCC tree it
5/6
init: move percpu_counter_tree_subsystem_init() earlier in boot
Move percpu_counter_tree_subsystem_init() from after trap_init() to immediately after setup_nr_cpu_ids() in start_kernel(). The function’s only dependency is nr_cpu_ids: it calls get_count_order(nr_c
6/6
lib: inline percpu_counter_tree_items_size with boot-safety sentinel
Replace the out-of-line percpu_counter_tree_items_size() function with a static inline that loads the __ro_after_init variable __percpu_counter_tree_items_size directly. This eliminates a function cal