Skip to content

Commit c789b5f

Browse files
surenbaghdasaryanakpm00
authored andcommitted
lib: add codetag reference into slabobj_ext
To store code tag for every slab object, a codetag reference is embedded into slabobj_ext when CONFIG_MEM_ALLOC_PROFILING=y. Link: https://lkml.kernel.org/r/20240321163705.3067592-23-surenb@google.com Signed-off-by: Suren Baghdasaryan <surenb@google.com> Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Tested-by: Kees Cook <keescook@chromium.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Alice Ryhl <aliceryhl@google.com> Cc: Andreas Hindborg <a.hindborg@samsung.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: "Björn Roy Baron" <bjorn3_gh@protonmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Christoph Lameter <cl@linux.com> Cc: Dennis Zhou <dennis@kernel.org> Cc: Gary Guo <gary@garyguo.net> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Pasha Tatashin <pasha.tatashin@soleen.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tejun Heo <tj@kernel.org> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 26865a1 commit c789b5f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

include/linux/memcontrol.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,12 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
16531653
* if MEMCG_DATA_OBJEXTS is set.
16541654
*/
16551655
struct slabobj_ext {
1656+
#ifdef CONFIG_MEMCG_KMEM
16561657
struct obj_cgroup *objcg;
1658+
#endif
1659+
#ifdef CONFIG_MEM_ALLOC_PROFILING
1660+
union codetag_ref ref;
1661+
#endif
16571662
} __aligned(8);
16581663

16591664
static inline void __inc_lruvec_kmem_state(void *p, enum node_stat_item idx)

lib/Kconfig.debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ config MEM_ALLOC_PROFILING
979979
depends on !DEBUG_FORCE_WEAK_PER_CPU
980980
select CODE_TAGGING
981981
select PAGE_EXTENSION
982+
select SLAB_OBJ_EXT
982983
help
983984
Track allocation source code and record total allocation size
984985
initiated at that code location. The mechanism can be used to track

0 commit comments

Comments
 (0)