v1
2026-09-06
按访问模式重排memcg结构字段 · v1
把 struct mem_cgroup 字段按访问模式分成热/冷/只读缓存行组,用编译期校验保证布局,防止无意性能回归。
原始补丁链接
子 Patch(6)
1/6
memcg: move per-node objcg to the read-mostly fields
current_obj_cgroup() reads memcg->nodeinfo[nid]->objcg on every accounted allocation. The field sits at the end of struct mem_cgroup_per_node, on the same cache line as lru_zone_size[] and iter. lru_z
2/6
memcg: split mem_cgroup_private_id into two fields
The two members of struct mem_cgroup_private_id have different access patterns. The id is read on every eviction and refault through mem_cgroup_private_id(), and is only written when the memcg is crea
3/6
memcg: group the write-hot fields of struct mem_cgroup
[memcg: group the write-hot fields of struct mem_cgroup] These fields are written on the charge, reclaim and socket paths: socket_pressure written by reclaim, read on every socket charge me
4/6
memcg: group the cold fields of struct mem_cgroup
[memcg: group the cold fields of struct mem_cgroup] These fields are only touched by the cgroup control paths: memory_peaks, swap_peaks, peaks_lock memory.peak open/read/release events_file, ev
5/6
memcg: group the read-mostly fields of struct mem_cgroup
[memcg: group the read-mostly fields of struct mem_cgroup] These fields are set when the memcg is created and only read after that: vmstats_percpu read on every stat update vmstats zswap_max,
6/6
memcg: group the fields of struct mem_cgroup_per_node
[memcg: group the fields of struct mem_cgroup_per_node] Replace the two ad-hoc CACHELINE_PADDING members with named cache line groups: memcg_pn_read_mostly memcg, lruvec_stats_percpu, lruvec_stat