diff options
author | Reed Riley <reed@riley.engineer> | 2024-04-15 21:08:13 -0700 |
---|---|---|
committer | Reed Riley <reed@riley.engineer> | 2024-04-15 21:08:13 -0700 |
commit | e5e8f203d77f90d1af8ebfd794eb1593582b85cc (patch) | |
tree | 4b247a45e411ea62d5af495eec775d3d48c40676 /mm/percpu-internal.h | |
parent | 6432d7745c1d0eba610fed85a8a6bac1864e858d (diff) | |
parent | 72cfb036b00a2c9f59a5d6ff1bc2d039ffb67490 (diff) |
Merge branch 'memalloc_prof_v6' of https://github.com/surenbaghdasaryan/linux
Diffstat (limited to 'mm/percpu-internal.h')
-rw-r--r-- | mm/percpu-internal.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index cdd0aa597a81..7e42f0ca3b7b 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -32,6 +32,19 @@ struct pcpu_block_md { int nr_bits; /* total bits responsible for */ }; +struct pcpuobj_ext { +#ifdef CONFIG_MEMCG_KMEM + struct obj_cgroup *cgroup; +#endif +#ifdef CONFIG_MEM_ALLOC_PROFILING + union codetag_ref tag; +#endif +}; + +#if defined(CONFIG_MEMCG_KMEM) || defined(CONFIG_MEM_ALLOC_PROFILING) +#define NEED_PCPUOBJ_EXT +#endif + struct pcpu_chunk { #ifdef CONFIG_PERCPU_STATS int nr_alloc; /* # of allocations */ @@ -64,8 +77,8 @@ struct pcpu_chunk { int end_offset; /* additional area required to have the region end page aligned */ -#ifdef CONFIG_MEMCG_KMEM - struct obj_cgroup **obj_cgroups; /* vector of object cgroups */ +#ifdef NEED_PCPUOBJ_EXT + struct pcpuobj_ext *obj_exts; /* vector of object cgroups */ #endif int nr_pages; /* # of pages served by this chunk */ @@ -74,6 +87,15 @@ struct pcpu_chunk { unsigned long populated[]; /* populated bitmap */ }; +static inline bool need_pcpuobj_ext(void) +{ + if (IS_ENABLED(CONFIG_MEM_ALLOC_PROFILING)) + return true; + if (!mem_cgroup_kmem_disabled()) + return true; + return false; +} + extern spinlock_t pcpu_lock; extern struct list_head *pcpu_chunk_lists; |