diff options
| author | Shakeel Butt <shakeel.butt@linux.dev> | 2026-09-04 20:05:18 -0700 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-08 22:54:40 -0700 |
| commit | 43eae38b7b294e6320a48e3f0a799ec6de3d34f6 (patch) | |
| tree | e48bfb21073574df7ed92d5ea6f364eca7e3d045 /include/linux | |
| parent | d307e85e4d7d002349723118cdb43da67e2c3447 (diff) | |
| download | linux-43eae38b7b294e6320a48e3f0a799ec6de3d34f6.tar.gz linux-43eae38b7b294e6320a48e3f0a799ec6de3d34f6.zip | |
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 created and
destroyed. The ref is written on every swap charge and uncharge.
Split them into private_id and private_id_ref so a later patch can put
them into different cache line groups. A struct member cannot be split
across two groups.
No functional change.
Link: https://lore.kernel.org/20260905030522.1887837-3-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/memcontrol.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index cfa1877915d4..32a959f1890a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -66,11 +66,6 @@ struct mem_cgroup_reclaim_cookie { #define MEM_CGROUP_ID_SHIFT 16 -struct mem_cgroup_private_id { - int id; - refcount_t ref; -}; - struct memcg_vmstats_percpu; struct memcg1_events_percpu; struct memcg_vmstats; @@ -189,7 +184,8 @@ struct mem_cgroup { struct cgroup_subsys_state css; /* Private memcg ID. Used to ID objects that outlive the cgroup */ - struct mem_cgroup_private_id id; + int private_id; + refcount_t private_id_ref; /* Accounted resources */ struct page_counter memory; /* Both v1 & v2 */ @@ -810,7 +806,7 @@ static inline unsigned short mem_cgroup_private_id(struct mem_cgroup *memcg) if (mem_cgroup_disabled()) return 0; - return memcg->id.id; + return memcg->private_id; } struct mem_cgroup *mem_cgroup_from_private_id(unsigned short id); |
