Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: memcg: put memcg1-specific struct mem_cgroup's members under CONFIG_MEMCG_V1

Put memcg1-specific members of struct mem_cgroup under the CONFIG_MEMCG_V1
config option. Also group them close to the end of struct mem_cgroup just
before the dynamic per-node part.

Link: https://lkml.kernel.org/r/20240628210317.272856-7-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Roman Gushchin and committed by
Andrew Morton
94b7e5bf 05dfec12

+68 -65
+68 -65
include/linux/memcontrol.h
··· 188 188 struct page_counter memsw; /* v1 only */ 189 189 }; 190 190 191 - /* Legacy consumer-oriented counters */ 192 - struct page_counter kmem; /* v1 only */ 193 - struct page_counter tcpmem; /* v1 only */ 194 - 195 191 /* Range enforcement for interrupt charges */ 196 192 struct work_struct high_work; 197 193 ··· 201 205 bool zswap_writeback; 202 206 #endif 203 207 204 - unsigned long soft_limit; 205 - 206 208 /* vmpressure notifications */ 207 209 struct vmpressure vmpressure; 208 210 ··· 209 215 */ 210 216 bool oom_group; 211 217 212 - /* protected by memcg_oom_lock */ 213 - bool oom_lock; 214 - int under_oom; 215 - 216 - int swappiness; 217 - /* OOM-Killer disable */ 218 - int oom_kill_disable; 218 + int swappiness; 219 219 220 220 /* memory.events and memory.events.local */ 221 221 struct cgroup_file events_file; ··· 217 229 218 230 /* handle for "memory.swap.events" */ 219 231 struct cgroup_file swap_events_file; 232 + 233 + CACHELINE_PADDING(_pad1_); 234 + 235 + /* memory.stat */ 236 + struct memcg_vmstats *vmstats; 237 + 238 + /* memory.events */ 239 + atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; 240 + atomic_long_t memory_events_local[MEMCG_NR_MEMORY_EVENTS]; 241 + 242 + /* 243 + * Hint of reclaim pressure for socket memroy management. Note 244 + * that this indicator should NOT be used in legacy cgroup mode 245 + * where socket memory is accounted/charged separately. 246 + */ 247 + unsigned long socket_pressure; 248 + 249 + #ifdef CONFIG_MEMCG_KMEM 250 + int kmemcg_id; 251 + /* 252 + * memcg->objcg is wiped out as a part of the objcg repaprenting 253 + * process. memcg->orig_objcg preserves a pointer (and a reference) 254 + * to the original objcg until the end of live of memcg. 255 + */ 256 + struct obj_cgroup __rcu *objcg; 257 + struct obj_cgroup *orig_objcg; 258 + /* list of inherited objcgs, protected by objcg_lock */ 259 + struct list_head objcg_list; 260 + #endif 261 + 262 + struct memcg_vmstats_percpu __percpu *vmstats_percpu; 263 + 264 + #ifdef CONFIG_CGROUP_WRITEBACK 265 + struct list_head cgwb_list; 266 + struct wb_domain cgwb_domain; 267 + struct memcg_cgwb_frn cgwb_frn[MEMCG_CGWB_FRN_CNT]; 268 + #endif 269 + 270 + #ifdef CONFIG_TRANSPARENT_HUGEPAGE 271 + struct deferred_split deferred_split_queue; 272 + #endif 273 + 274 + #ifdef CONFIG_LRU_GEN_WALKS_MMU 275 + /* per-memcg mm_struct list */ 276 + struct lru_gen_mm_list mm_list; 277 + #endif 278 + 279 + #ifdef CONFIG_MEMCG_V1 280 + /* Legacy consumer-oriented counters */ 281 + struct page_counter kmem; /* v1 only */ 282 + struct page_counter tcpmem; /* v1 only */ 283 + 284 + unsigned long soft_limit; 285 + 286 + /* protected by memcg_oom_lock */ 287 + bool oom_lock; 288 + int under_oom; 289 + 290 + /* OOM-Killer disable */ 291 + int oom_kill_disable; 220 292 221 293 /* protect arrays of thresholds */ 222 294 struct mutex thresholds_lock; ··· 296 248 */ 297 249 unsigned long move_charge_at_immigrate; 298 250 /* taken only while moving_account > 0 */ 299 - spinlock_t move_lock; 300 - unsigned long move_lock_flags; 301 - 302 - CACHELINE_PADDING(_pad1_); 303 - 304 - /* memory.stat */ 305 - struct memcg_vmstats *vmstats; 306 - 307 - /* memory.events */ 308 - atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS]; 309 - atomic_long_t memory_events_local[MEMCG_NR_MEMORY_EVENTS]; 310 - 311 - /* 312 - * Hint of reclaim pressure for socket memroy management. Note 313 - * that this indicator should NOT be used in legacy cgroup mode 314 - * where socket memory is accounted/charged separately. 315 - */ 316 - unsigned long socket_pressure; 251 + spinlock_t move_lock; 252 + unsigned long move_lock_flags; 317 253 318 254 /* Legacy tcp memory accounting */ 319 - bool tcpmem_active; 320 - int tcpmem_pressure; 321 - 322 - #ifdef CONFIG_MEMCG_KMEM 323 - int kmemcg_id; 324 - /* 325 - * memcg->objcg is wiped out as a part of the objcg repaprenting 326 - * process. memcg->orig_objcg preserves a pointer (and a reference) 327 - * to the original objcg until the end of live of memcg. 328 - */ 329 - struct obj_cgroup __rcu *objcg; 330 - struct obj_cgroup *orig_objcg; 331 - /* list of inherited objcgs, protected by objcg_lock */ 332 - struct list_head objcg_list; 333 - #endif 255 + bool tcpmem_active; 256 + int tcpmem_pressure; 334 257 335 258 CACHELINE_PADDING(_pad2_); 336 259 337 260 /* 338 261 * set > 0 if pages under this cgroup are moving to other cgroup. 339 262 */ 340 - atomic_t moving_account; 341 - struct task_struct *move_lock_task; 342 - 343 - struct memcg_vmstats_percpu __percpu *vmstats_percpu; 344 - 345 - #ifdef CONFIG_CGROUP_WRITEBACK 346 - struct list_head cgwb_list; 347 - struct wb_domain cgwb_domain; 348 - struct memcg_cgwb_frn cgwb_frn[MEMCG_CGWB_FRN_CNT]; 349 - #endif 263 + atomic_t moving_account; 264 + struct task_struct *move_lock_task; 350 265 351 266 /* List of events which userspace want to receive */ 352 267 struct list_head event_list; 353 268 spinlock_t event_list_lock; 354 - 355 - #ifdef CONFIG_TRANSPARENT_HUGEPAGE 356 - struct deferred_split deferred_split_queue; 357 - #endif 358 - 359 - #ifdef CONFIG_LRU_GEN_WALKS_MMU 360 - /* per-memcg mm_struct list */ 361 - struct lru_gen_mm_list mm_list; 362 - #endif 269 + #endif /* CONFIG_MEMCG_V1 */ 363 270 364 271 struct mem_cgroup_per_node *nodeinfo[]; 365 272 };