alloc_tag: mark inaccurate allocation counters in /proc/allocinfo output
Subsystems (5)
Suren Baghdasaryan
maintainerPATCH 1/1 alloc_tag: mark inaccurate allocation counters in /proc/allocinfo output
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the /proc/allocinfo output.
Bump up /proc/allocinfo version to reflect change in the file format.
Example output with invalid counters:
allocinfo - version: 2.0
0 0 arch/x86/kernel/kdebugfs.c:105 func:create_setup_data_nodes
0 0 arch/x86/kernel/alternative.c:2090 func:alternatives_smp_module_add
0* 0* arch/x86/kernel/alternative.c:127 func:__its_alloc
0 0 arch/x86/kernel/fpu/regset.c:160 func:xstateregs_set
0 0 arch/x86/kernel/fpu/xstate.c:1590 func:fpstate_realloc
0 0 arch/x86/kernel/cpu/aperfmperf.c:379 func:arch_enable_hybrid_capacity_scale
0 0 arch/x86/kernel/cpu/amd_cache_disable.c:258 func:init_amd_l3_attrs
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create
32768 1 arch/x86/kernel/cpu/mce/genpool.c:132 func:mce_gen_pool_create
0 0 arch/x86/kernel/cpu/mce/amd.c:1341 func:mce_threshold_create_device
---
Patch is based on mm-new.
include/linux/alloc_tag.h | 12 ++++++++++++ include/linux/codetag.h | 5 ++++- lib/alloc_tag.c | 7 +++++-- mm/slub.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-)
include/linux/alloc_tag.h +12 -0
@@ -221,6 +221,16 @@ static inline void alloc_tag_sub(union codetag_ref *ref, size_t bytes) ref->ct = NULL; } +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) +{ + tag->ct.flags |=CODETAG_FLAG_INACCURATE ; +} + +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) +{ +return !!(tag->ct.flags &CODETAG_FLAG_INACCURATE ); +} +#define alloc_tag_record (p) ((p) = current->alloc_tag)#else /* CONFIG_MEM_ALLOC_PROFILING */
@@ -230,6 +240,8 @@ static inline bool mem_alloc_profiling_enabled(void) { return false; }static inline void alloc_tag_add (union codetag_ref *ref,struct alloc_tag *tag,size_t bytes) {}static inline void alloc_tag_sub (union codetag_ref *ref,size_t bytes) {} +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) {} +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) {return false; }#define alloc_tag_record (p) do {} while (0)#endif /* CONFIG_MEM_ALLOC_PROFILING */
include/linux/codetag.h +4 -1
@@ -16,13 +16,16 @@ struct module;#define CODETAG_SECTION_START_PREFIX "__start_"#define CODETAG_SECTION_STOP_PREFIX "__stop_" +/* codetag flags */ +#define CODETAG_FLAG_INACCURATE (1 << 0) +/* * An instance of this structure is created in a special ELF section at every * code location being tagged. At runtime, the special section is treated as * an array of these. */ struct codetag { -unsigned int flags;/* used in later patches */ +unsigned int flags;unsigned int lineno;const char *modname;const char *function;
lib/alloc_tag.c +5 -2
@@ -80,7 +80,7 @@ static void allocinfo_stop(struct seq_file *m, void *arg)static void print_allocinfo_header (struct seq_buf *buf) {/* Output format version, so we can change it. */ -seq_buf_printf (buf,"allocinfo - version: 1.0\n" ); +seq_buf_printf (buf,"allocinfo - version: 2.0\n" );seq_buf_printf (buf,"# <size> <calls> <tag info>\n" ); }
@@ -90,7 +90,10 @@ static void alloc_tag_to_text(struct seq_buf *out, struct codetag *ct)struct alloc_tag_counters counter =alloc_tag_read (tag);s64 bytes = counter.bytes; -seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls); +if (unlikely (alloc_tag_is_inaccurate (tag))) +seq_buf_printf (out,"%11lli* %7llu* " , bytes, counter.calls); +else +seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls);codetag_to_text (out, ct);seq_buf_putc (out,' ' );seq_buf_putc (out,'\n' );
mm/slub.c +2 -0
@@ -2143,6 +2143,8 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)*/ if (likely (obj_exts))alloc_tag_add (&obj_exts->ref, current->alloc_tag, s->size); +else +alloc_tag_set_inaccurate (current->alloc_tag); } static inline void
base-commit: f4e8f46973fe0c0f579944a37e96ba9efbe00cca
Signature · 1 line
2.51.0.384.g4c02a37b29-goog
Quoted 21 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_device
Quoted 2 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>
Quoted 7 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.
Since it's rare, is it worth the trouble?
Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_device
Quoted 1 line
Suggested-by Johannes Weiner <[email protected]>
Here a link might have been helpful :)
Quoted 102 lines
Signed-off-by Suren Baghdasaryan <[email protected]>---
Patch is based on mm-new.include/linux/alloc_tag.h | 12 ++++++++++++ include/linux/codetag.h | 5 ++++- lib/alloc_tag.c | 7 +++++-- mm/slub.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-)include/linux/alloc_tag.h +12
-0@@ -221,6 +221,16 @@ static inline void alloc_tag_sub(union codetag_ref *ref, size_t bytes) ref->ct = NULL; } +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) +{ + tag->ct.flags |=CODETAG_FLAG_INACCURATE ; +} + +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) +{ +return !!(tag->ct.flags &CODETAG_FLAG_INACCURATE ); +} +#define alloc_tag_record (p) ((p) = current->alloc_tag)#else /* CONFIG_MEM_ALLOC_PROFILING */ @@ -230,6 +240,8 @@ static inline bool mem_alloc_profiling_enabled(void) { return false; }static inline void alloc_tag_add (union codetag_ref *ref,struct alloc_tag *tag,size_t bytes) {}static inline void alloc_tag_sub (union codetag_ref *ref,size_t bytes) {} +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) {} +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) {return false; }#define alloc_tag_record (p) do {} while (0)#endif /* CONFIG_MEM_ALLOC_PROFILING */ include/linux/codetag.h +4
-1@@ -16,13 +16,16 @@ struct module;#define CODETAG_SECTION_START_PREFIX "__start_"#define CODETAG_SECTION_STOP_PREFIX "__stop_" +/* codetag flags */ +#define CODETAG_FLAG_INACCURATE (1 << 0) +/* * An instance of this structure is created in a special ELF section at every * code location being tagged. At runtime, the special section is treated as * an array of these. */ struct codetag { -unsigned int flags;/* used in later patches */ +unsigned int flags;unsigned int lineno;const char *modname;const char *function;lib/alloc_tag.c +5
-2@@ -80,7 +80,7 @@ static void allocinfo_stop(struct seq_file *m, void *arg)static void print_allocinfo_header (struct seq_buf *buf) {/* Output format version, so we can change it. */ -seq_buf_printf (buf,"allocinfo - version: 1.0\n" ); +seq_buf_printf (buf,"allocinfo - version: 2.0\n" );seq_buf_printf (buf,"# <size> <calls> <tag info>\n" ); }@@ -90,7 +90,10 @@ static void alloc_tag_to_text(struct seq_buf *out, struct codetag *ct)struct alloc_tag_counters counter =alloc_tag_read (tag);s64 bytes = counter.bytes; -seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls); +if (unlikely (alloc_tag_is_inaccurate (tag))) +seq_buf_printf (out,"%11lli* %7llu* " , bytes, counter.calls); +else +seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls);codetag_to_text (out, ct);seq_buf_putc (out,' ' );seq_buf_putc (out,'\n' );mm/slub.c +2
-0@@ -2143,6 +2143,8 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)*/ if (likely (obj_exts))alloc_tag_add (&obj_exts->ref, current->alloc_tag, s->size); +else +alloc_tag_set_inaccurate (current->alloc_tag); } static inline voidbase-commit:
f4e8f46973fe0c0f579944a37e96ba9efbe00cca
Suren Baghdasaryan
maintainerQuoted 11 lines · Vlastimil Babka
Quoted 7 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Since it's rare, is it worth the trouble?
Apparently they are seen in Meta's fleet which instigated this thread:
https://lore.kernel.org/all/[email protected]/
Quoted 14 lines
Quoted 14 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_device
Quoted 3 lines
Quoted 1 line
Suggested-by Johannes Weiner <[email protected]>Here a link might have been helpful :)
Right, here it is and suggestion is in the last paragraph:
https://lore.kernel.org/all/[email protected]/
Quoted 104 lines
Quoted 103 lines
Signed-off-by Suren Baghdasaryan <[email protected]>---
Patch is based on mm-new.include/linux/alloc_tag.h | 12 ++++++++++++ include/linux/codetag.h | 5 ++++- lib/alloc_tag.c | 7 +++++-- mm/slub.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-)include/linux/alloc_tag.h +12
-0@@ -221,6 +221,16 @@ static inline void alloc_tag_sub(union codetag_ref *ref, size_t bytes) ref->ct = NULL; } +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) +{ + tag->ct.flags |=CODETAG_FLAG_INACCURATE ; +} + +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) +{ +return !!(tag->ct.flags &CODETAG_FLAG_INACCURATE ); +} +#define alloc_tag_record (p) ((p) = current->alloc_tag)#else /* CONFIG_MEM_ALLOC_PROFILING */ @@ -230,6 +240,8 @@ static inline bool mem_alloc_profiling_enabled(void) { return false; }static inline void alloc_tag_add (union codetag_ref *ref,struct alloc_tag *tag,size_t bytes) {}static inline void alloc_tag_sub (union codetag_ref *ref,size_t bytes) {} +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) {} +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) {return false; }#define alloc_tag_record (p) do {} while (0)#endif /* CONFIG_MEM_ALLOC_PROFILING */ include/linux/codetag.h +4
-1@@ -16,13 +16,16 @@ struct module;#define CODETAG_SECTION_START_PREFIX "__start_"#define CODETAG_SECTION_STOP_PREFIX "__stop_" +/* codetag flags */ +#define CODETAG_FLAG_INACCURATE (1 << 0) +/* * An instance of this structure is created in a special ELF section at every * code location being tagged. At runtime, the special section is treated as * an array of these. */ struct codetag { -unsigned int flags;/* used in later patches */ +unsigned int flags;unsigned int lineno;const char *modname;const char *function;lib/alloc_tag.c +5
-2@@ -80,7 +80,7 @@ static void allocinfo_stop(struct seq_file *m, void *arg)static void print_allocinfo_header (struct seq_buf *buf) {/* Output format version, so we can change it. */ -seq_buf_printf (buf,"allocinfo - version: 1.0\n" ); +seq_buf_printf (buf,"allocinfo - version: 2.0\n" );seq_buf_printf (buf,"# <size> <calls> <tag info>\n" ); }@@ -90,7 +90,10 @@ static void alloc_tag_to_text(struct seq_buf *out, struct codetag *ct)struct alloc_tag_counters counter =alloc_tag_read (tag);s64 bytes = counter.bytes; -seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls); +if (unlikely (alloc_tag_is_inaccurate (tag))) +seq_buf_printf (out,"%11lli* %7llu* " , bytes, counter.calls); +else +seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls);codetag_to_text (out, ct);seq_buf_putc (out,' ' );seq_buf_putc (out,'\n' );mm/slub.c +2
-0@@ -2143,6 +2143,8 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)*/ if (likely (obj_exts))alloc_tag_add (&obj_exts->ref, current->alloc_tag, s->size); +else +alloc_tag_set_inaccurate (current->alloc_tag); } static inline voidbase-commit:
f4e8f46973fe0c0f579944a37e96ba9efbe00cca
Usama Arif
Acked-byQuoted 11 lines · Suren Baghdasaryan
Quoted 10 lines · Vlastimil Babka
Quoted 7 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.
Quoted 5 lines
Quoted 1 line
Since it's rare, is it worth the trouble?
Apparently they are seen in Meta's fleet which instigated this thread:
https://lore.kernel.org/all/[email protected]/
Yes it happens on memory bound services!
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_device
Quoted 10 lines
Quoted 3 lines
Quoted 1 line
Suggested-by Johannes Weiner <[email protected]>Here a link might have been helpful :)
Right, here it is and suggestion is in the last paragraph:
https://lore.kernel.org/all/[email protected]/Quoted 3 lines
Quoted 3 lines
Signed-off-by Suren Baghdasaryan <[email protected]>---
Quoted 101 lines
Quoted 101 lines
Quoted 100 lines
Patch is based on mm-new.
include/linux/alloc_tag.h | 12 ++++++++++++ include/linux/codetag.h | 5 ++++- lib/alloc_tag.c | 7 +++++-- mm/slub.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-)include/linux/alloc_tag.h +12
-0@@ -221,6 +221,16 @@ static inline void alloc_tag_sub(union codetag_ref *ref, size_t bytes) ref->ct = NULL; } +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) +{ + tag->ct.flags |=CODETAG_FLAG_INACCURATE ; +} + +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) +{ +return !!(tag->ct.flags &CODETAG_FLAG_INACCURATE ); +} +#define alloc_tag_record (p) ((p) = current->alloc_tag)#else /* CONFIG_MEM_ALLOC_PROFILING */ @@ -230,6 +240,8 @@ static inline bool mem_alloc_profiling_enabled(void) { return false; }static inline void alloc_tag_add (union codetag_ref *ref,struct alloc_tag *tag,size_t bytes) {}static inline void alloc_tag_sub (union codetag_ref *ref,size_t bytes) {} +static inline void alloc_tag_set_inaccurate (struct alloc_tag *tag) {} +static inline bool alloc_tag_is_inaccurate (struct alloc_tag *tag) {return false; }#define alloc_tag_record (p) do {} while (0)#endif /* CONFIG_MEM_ALLOC_PROFILING */ include/linux/codetag.h +4
-1@@ -16,13 +16,16 @@ struct module;#define CODETAG_SECTION_START_PREFIX "__start_"#define CODETAG_SECTION_STOP_PREFIX "__stop_" +/* codetag flags */ +#define CODETAG_FLAG_INACCURATE (1 << 0) +/* * An instance of this structure is created in a special ELF section at every * code location being tagged. At runtime, the special section is treated as * an array of these. */ struct codetag { -unsigned int flags;/* used in later patches */ +unsigned int flags;unsigned int lineno;const char *modname;const char *function;lib/alloc_tag.c +5
-2@@ -80,7 +80,7 @@ static void allocinfo_stop(struct seq_file *m, void *arg)static void print_allocinfo_header (struct seq_buf *buf) {/* Output format version, so we can change it. */ -seq_buf_printf (buf,"allocinfo - version: 1.0\n" ); +seq_buf_printf (buf,"allocinfo - version: 2.0\n" );seq_buf_printf (buf,"# <size> <calls> <tag info>\n" ); }@@ -90,7 +90,10 @@ static void alloc_tag_to_text(struct seq_buf *out, struct codetag *ct)struct alloc_tag_counters counter =alloc_tag_read (tag);s64 bytes = counter.bytes; -seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls); +if (unlikely (alloc_tag_is_inaccurate (tag))) +seq_buf_printf (out,"%11lli* %7llu* " , bytes, counter.calls); +else +seq_buf_printf (out,"%12lli %8llu " , bytes, counter.calls);codetag_to_text (out, ct);seq_buf_putc (out,' ' );seq_buf_putc (out,'\n' );mm/slub.c +2
-0@@ -2143,6 +2143,8 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)*/ if (likely (obj_exts))alloc_tag_add (&obj_exts->ref, current->alloc_tag, s->size); +else +alloc_tag_set_inaccurate (current->alloc_tag); } static inline voidbase-commit:
f4e8f46973fe0c0f579944a37e96ba9efbe00cca
Quoted 21 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_device
Quoted 2 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>
Thanks Suren!
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.
Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_device
Hi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to change
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create
to
+49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.
Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to change
Quoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 12 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Thanks
Pan
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create
Could we do something like:
49152 48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create(inaccurate)
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
Quoted 15 lines
Quoted 12 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Thanks
Pan
Suren Baghdasaryan
maintainerQuoted 50 lines · Usama Arif
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 7 lines
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)
If there is a postprocessing then this would break sometimes later when the function name is parsed, right? So IMO that just postpones the breakage.
Quoted 5 lines
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
I'm wondering if we add a new column at the end like this:
49152 48 arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create [inaccurate]
would that break the parsing tools?
Well-designed parsers usually throw away additional fields which they don't know how to parse. WDYT?
Quoted 17 lines
Quoted 16 lines
Quoted 13 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Thanks
Pan
Quoted 69 lines · Suren Baghdasaryan
Quoted 50 lines · Usama Arif
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 7 lines
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)If there is a postprocessing then this would break sometimes later when the function name is parsed, right? So IMO that just postpones the breakage.
Quoted 5 lines
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
Quoted 9 lines
I'm wondering if we add a new column at the end like this:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create [inaccurate]would that break the parsing tools?
Well-designed parsers usually throw away additional fields which they don't know how to parse. WDYT?
It would break the parse now as we count the number of string to decide if there is an optional module name or not. I don't think it is a big deal to fix though.
I think one more important thing is probably to reach a consensus on what format can be changed in the future, for example say, we can keep adding columns but not change the format the type of one column. With such consensus in mind, it will be easier to design the parser. And I guess many companies will build parser upon this info for fleet- wise collection.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Thanks
Pan
Thanks
Pan
Quoted 75 lines · Yueyang Pan
Quoted 74 lines · Suren Baghdasaryan
Quoted 50 lines · Usama Arif
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 7 lines
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)If there is a postprocessing then this would break sometimes later when the function name is parsed, right? So IMO that just postpones the breakage.
Quoted 5 lines
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
I'm wondering if we add a new column at the end like this:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create [inaccurate]
Quoted 8 lines
Quoted 4 lines
would that break the parsing tools?
Well-designed parsers usually throw away additional fields which they don't know how to parse. WDYT?It would break the parse now as we count the number of string to decide if there is an optional module name or not. I don't think it is a big deal to fix though.
The inconsistent of module name is really inconvenient for parsing..... Could we make changes to make it consistent, something like:
lib/codetag.c +1 -1
@@ -124,7 +124,7 @@ void codetag_to_text(struct seq_buf *out, struct codetag *ct) ct->filename, ct->lineno, ct->modname, ct->function); else - seq_buf_printf(out, "%s:%u func:%s", + seq_buf_printf(out, "%s:%u [kernel] func:%s", ct->filename, ct->lineno, ct->function); }
Quoted 28 lines
I think one more important thing is probably to reach a consensus on what format can be changed in the future, for example say, we can keep adding columns but not change the format the type of one column. With such consensus in mind, it will be easier to design the parser. And I guess many companies will build parser upon this info for fleet- wise collection.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Thanks
PanThanks
Pan
Suren Baghdasaryan
maintainerQuoted 78 lines · David Wang
Quoted 75 lines · Yueyang Pan
Quoted 74 lines · Suren Baghdasaryan
Quoted 50 lines · Usama Arif
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 7 lines
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)If there is a postprocessing then this would break sometimes later when the function name is parsed, right? So IMO that just postpones the breakage.
Quoted 5 lines
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
I'm wondering if we add a new column at the end like this:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create [inaccurate]
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
would that break the parsing tools?
Well-designed parsers usually throw away additional fields which they don't know how to parse. WDYT?It would break the parse now as we count the number of string to decide if there is an optional module name or not. I don't think it is a big deal to fix though.
Uh, right. We do have module name as an optional field...
Quoted 9 lines
The inconsistent of module name is really inconvenient for parsing..... Could we make changes to make it consistent, something like:
lib/codetag.c +0
-0
lib/codetag.c void codetag_to_text(struct seq_buf *out, struct codetag *ct) · line 127
Quoted 5 lines
lib/codetag.c +1
-1@@ -124,7 +124,7 @@ void codetag_to_text(struct seq_buf *out, struct codetag *ct) ct->filename, ct->lineno, ct->modname, ct->function); else - seq_buf_printf(out, "%s:%u func:%s", + seq_buf_printf(out, "%s:%u [kernel] func:%s",
Yeah, until someone creates a module called "kernel" :) We could keep the name empty like this:
+ seq_buf_printf(out, "%s:%u [] func:%s",
but I'm not sure that's the best solution.
If we are really concerned about parsers, I could add an ioctl interface to query the counters which are inaccurate. Would that be better?
BTW, I have other ideas for ioctls, like filtering-out 0-sized allocations and such.
Quoted 34 lines
lib/codetag.c +0
-0ct->filename, ct->lineno, ct->function); }Quoted 31 lines
I think one more important thing is probably to reach a consensus on what format can be changed in the future, for example say, we can keep adding columns but not change the format the type of one column. With such consensus in mind, it will be easier to design the parser. And I guess many companies will build parser upon this info for fleet- wise collection.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Thanks
PanThanks
Pan
Quoted 108 lines · Suren Baghdasaryan
Quoted 78 lines · David Wang
Quoted 75 lines · Yueyang Pan
Quoted 74 lines · Suren Baghdasaryan
Quoted 50 lines · Usama Arif
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 7 lines
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)If there is a postprocessing then this would break sometimes later when the function name is parsed, right? So IMO that just postpones the breakage.
Quoted 5 lines
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
I'm wondering if we add a new column at the end like this:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create [inaccurate]Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
would that break the parsing tools?
Well-designed parsers usually throw away additional fields which they don't know how to parse. WDYT?It would break the parse now as we count the number of string to decide if there is an optional module name or not. I don't think it is a big deal to fix though.
Uh, right. We do have module name as an optional field...
Quoted 9 lines
The inconsistent of module name is really inconvenient for parsing..... Could we make changes to make it consistent, something like:
lib/codetag.c +0
-0lib/codetag.c void codetag_to_text(struct seq_buf *out, struct codetag *ct) · line 127
Quoted 5 lines
lib/codetag.c +1
-1@@ -124,7 +124,7 @@ void codetag_to_text(struct seq_buf *out, struct codetag *ct) ct->filename, ct->lineno, ct->modname, ct->function); else - seq_buf_printf(out, "%s:%u func:%s", + seq_buf_printf(out, "%s:%u [kernel] func:%s",Yeah, until someone creates a module called "kernel" :) We could keep the name empty like this:
Quoted 4 lines
+ seq_buf_printf(out, "%s:%u [] func:%s",
but I'm not sure that's the best solution.
I guess the best option would be to decide how the format can evolve in the future with some rules in comment or doc. But I am sure who will decide the rules...
Quoted 3 lines
If we are really concerned about parsers, I could add an ioctl interface to query the counters which are inaccurate. Would that be better?
I think this would be nice as we just need to add functionality on top of the parser when we do need it. I guess most of the time we don't care about that temporary imprecision.
Quoted 3 lines
BTW, I have other ideas for ioctls, like filtering-out 0-sized allocations and such.
You mean using ioctl to control if we only print out the non zero ones?
Quoted 29 lines
Quoted 29 lines
lib/codetag.c +0
-0ct->filename, ct->lineno, ct->function); }Quoted 25 lines
I think one more important thing is probably to reach a consensus on what format can be changed in the future, for example say, we can keep adding columns but not change the format the type of one column. With such consensus in mind, it will be easier to design the parser. And I guess many companies will build parser upon this info for fleet- wise collection.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Thanks
PanThanks
Pan
Thanks
Pan
Suren Baghdasaryan
maintainerQuoted 119 lines · Yueyang Pan
Quoted 108 lines · Suren Baghdasaryan
Quoted 78 lines · David Wang
Quoted 75 lines · Yueyang Pan
Quoted 74 lines · Suren Baghdasaryan
Quoted 50 lines · Usama Arif
Quoted 36 lines · Yueyang Pan
Quoted 28 lines · David Wang
Quoted 8 lines · Suren Baghdasaryan
While rare, memory allocation profiling can contain inaccurate counters if slab object extension vector allocation fails. That allocation might succeed later but prior to that, slab allocations that would have used that object extension vector will not be accounted for. To indicate incorrect counters, mark them with an asterisk in the
/proc/allocinfooutput.
Bump up/proc/allocinfoversion to reflect change in the file format.Quoted 13 lines
Example output with invalid counters:
allocinfo - version: 2.0
0 0arch/x86/kernel/kdebugfs.c:105func:create_setup_data_nodes
0 0arch/x86/kernel/alternative.c:2090func:alternatives_smp_module_add
0* 0*arch/x86/kernel/alternative.c:127func:__its_alloc
0 0arch/x86/kernel/fpu/regset.c:160func:xstateregs_set
0 0arch/x86/kernel/fpu/xstate.c:1590func:fpstate_realloc
0 0arch/x86/kernel/cpu/aperfmperf.c:379func:arch_enable_hybrid_capacity_scale
0 0arch/x86/kernel/cpu/amd_cache_disable.c:258func:init_amd_l3_attrs
49152* 48*arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create
32768 1arch/x86/kernel/cpu/mce/genpool.c:132func:mce_gen_pool_create
0 0arch/x86/kernel/cpu/mce/amd.c:1341func:mce_threshold_create_deviceHi,
The changes may break some client tools, mine included.... I don't mind adjusting my tools, but still
Is it acceptable to changeQuoted 6 lines
49152* 48* arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create to +49152 +48 arch/x86/kernel/cpu/mce/core.c:2709 func:mce_device_create*The '+' sign make it still standout when view from a terminal, and client tools, not all of them though, might not need any changes. And when client want to filter out inaccurate data items, it could be done by checking the tailing '*" of func name.
Quoted 9 lines
I agree with David on this point. We already have monitoring tool built on top of this output across meta fleet. Ideally we would like to keep the format of of size and calls the same, even for future version, because adding a * will change the format from int to str, which leads to change over the regex parser many places.
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Quoted 7 lines
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)If there is a postprocessing then this would break sometimes later when the function name is parsed, right? So IMO that just postpones the breakage.
Quoted 5 lines
This should hopefully not require any changes to the tools that are consuming this file. I think it might be better to use "(inaccurate)" (without any space after function name) or some other text instead of "+" or "*" to prevent breaking such tools. I dont think we need to even increment allocinfo version number as well then?
I'm wondering if we add a new column at the end like this:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create [inaccurate]Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
would that break the parsing tools?
Well-designed parsers usually throw away additional fields which they don't know how to parse. WDYT?It would break the parse now as we count the number of string to decide if there is an optional module name or not. I don't think it is a big deal to fix though.
Uh, right. We do have module name as an optional field...
Quoted 9 lines
The inconsistent of module name is really inconvenient for parsing..... Could we make changes to make it consistent, something like:
lib/codetag.c +0
-0lib/codetag.c void codetag_to_text(struct seq_buf *out, struct codetag *ct) · line 127
Quoted 5 lines
lib/codetag.c +1
-1@@ -124,7 +124,7 @@ void codetag_to_text(struct seq_buf *out, struct codetag *ct) ct->filename, ct->lineno, ct->modname, ct->function); else - seq_buf_printf(out, "%s:%u func:%s", + seq_buf_printf(out, "%s:%u [kernel] func:%s",Yeah, until someone creates a module called "kernel" :) We could keep the name empty like this:
Quoted 4 lines
+ seq_buf_printf(out, "%s:%u [] func:%s",
but I'm not sure that's the best solution.
I guess the best option would be to decide how the format can evolve in the future with some rules in comment or doc. But I am sure who will decide the rules...
Quoted 7 lines
Quoted 3 lines
If we are really concerned about parsers, I could add an ioctl interface to query the counters which are inaccurate. Would that be better?
I think this would be nice as we just need to add functionality on top of the parser when we do need it. I guess most of the time we don't care about that temporary imprecision.
We don't care about it until it happens :) I think it would be nice to have a very visible indication that some values are inaccurate. ioclt would not do that unfortunately...
Another option is to use the "[]" where we currently encode only module name to express extra info:
No module, accurate counters:
0 0 arch/x86/kernel/kdebugfs.c:105 func:create_setup_data_nodes
Module, accurate counters:
0 0 arch/x86/kernel/kdebugfs.c:105 [my_module]
func:create_setup_data_nodes
No module, inaccurate counters:
0 0 arch/x86/kernel/kdebugfs.c:105 [,inaccurate]
func:create_setup_data_nodes
Module, inaccurate counters:
0 0 arch/x86/kernel/kdebugfs.c:105 [my_module,inaccurate]
func:create_setup_data_nodes
Then the rule for parsers would be that whatever is in [] can be extended with additional values. If they do not recognize the value, just ignore it.
Quoted 7 lines
Quoted 4 lines
BTW, I have other ideas for ioctls, like filtering-out 0-sized allocations and such.
You mean using ioctl to control if we only print out the non zero ones?
Correct.
Quoted 39 lines
Quoted 30 lines
Quoted 30 lines
lib/codetag.c +0
-0ct->filename, ct->lineno, ct->function); }Quoted 25 lines
I think one more important thing is probably to reach a consensus on what format can be changed in the future, for example say, we can keep adding columns but not change the format the type of one column. With such consensus in mind, it will be easier to design the parser. And I guess many companies will build parser upon this info for fleet- wise collection.
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
(There would be some corner cases, for example, the '+' sign may not needed when the value reach a negative value if some underflow bug happened)
Thanks
David.Quoted 3 lines
Suggested-by Johannes Weiner <[email protected]>Signed-off-by Suren Baghdasaryan <[email protected]>---
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Thanks
PanThanks
PanThanks
Pan
Andrew Morton
maintainerQuoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)
Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
I don't know if this was by design, but the present format does provide extensibility. It is basically
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Whatev. I'll drop this version from mm.git.
Suren Baghdasaryan
maintainerQuoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
Quoted 7 lines
I don't know if this was by design, but the present format does provide extensibility. It is basically
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Actually that sounds like the best idea so far. Currently the format is:
<bytes> <count> <file>:<line> [<module>] func:<function>
We can adopt a rule that after this, the line can contain additional key:value pairs. In that case for inaccurate lines we can add:
49152 48 arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create accurate:no
In the future we can append more key:value pairs if we need them. Parsers which don't know how to parse a new key can simply ignore them.
Does that sound good to everyone?
Quoted 3 lines
Whatev. I'll drop this version from mm.git.
Quoted 36 lines · Suren Baghdasaryan
Quoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
Quoted 7 lines
I don't know if this was by design, but the present format does provide extensibility. It is basically
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Actually that sounds like the best idea so far. Currently the format is:
<bytes> <count> <file>:<line> [<module>] func:<function>
We can adopt a rule that after this, the line can contain additional key:value pairs. In that case for inaccurate lines we can add:
Quoted 8 lines
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create accurate:noIn the future we can append more key:value pairs if we need them. Parsers which don't know how to parse a new key can simply ignore them.
Does that sound good to everyone?
This looks good to me, at least for my tools. :)
On my system, there are 4K+ lines of items, each byte added would increase 4K+bytes for one read, but good thing is normally "accurate:no" would not show up.
David
Quoted 4 lines
Quoted 4 lines
Whatev. I'll drop this version from mm.git.
Quoted 36 lines · Suren Baghdasaryan
Quoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
Quoted 7 lines
I don't know if this was by design, but the present format does provide extensibility. It is basically
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Actually that sounds like the best idea so far. Currently the format is:
<bytes> <count> <file>:<line> [<module>] func:<function>
We can adopt a rule that after this, the line can contain additional key:value pairs. In that case for inaccurate lines we can add:
Quoted 8 lines
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create accurate:noIn the future we can append more key:value pairs if we need them. Parsers which don't know how to parse a new key can simply ignore them.
Does that sound good to everyone?
Yeah I agree on this proposal. We can keep this convention.
Quoted 4 lines
Quoted 4 lines
Whatev. I'll drop this version from mm.git.
Suren Baghdasaryan
maintainerQuoted 41 lines · Yueyang Pan
Quoted 39 lines · Suren Baghdasaryan
Quoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
Quoted 7 lines
I don't know if this was by design, but the present format does provide extensibility. It is basically
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Actually that sounds like the best idea so far. Currently the format is:
<bytes> <count> <file>:<line> [<module>] func:<function>
We can adopt a rule that after this, the line can contain additional key:value pairs. In that case for inaccurate lines we can add:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create accurate:no
Quoted 7 lines
Quoted 5 lines
In the future we can append more key:value pairs if we need them. Parsers which don't know how to parse a new key can simply ignore them.
Does that sound good to everyone?
Yeah I agree on this proposal. We can keep this convention.
Ok, if no further objections I'll post the next version and will document that v2 allows additional key:value pairs in each line. Thanks,
Suren.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Whatev. I'll drop this version from mm.git.
Quoted 46 lines · Suren Baghdasaryan
Quoted 45 lines · Yueyang Pan
Quoted 43 lines · Suren Baghdasaryan
Quoted 20 lines · Andrew Morton
Quoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
Quoted 7 lines
I don't know if this was by design, but the present format does provide extensibility. It is basically
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Actually that sounds like the best idea so far. Currently the format is:
<bytes> <count> <file>:<line> [<module>] func:<function>
We can adopt a rule that after this, the line can contain additional key:value pairs. In that case for inaccurate lines we can add:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709
func:mce_device_create accurate:noIn the future we can append more key:value pairs if we need them. Parsers which don't know how to parse a new key can simply ignore them.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Does that sound good to everyone?
Yeah I agree on this proposal. We can keep this convention.
Ok, if no further objections I'll post the next version and will document that v2 allows additional key:value pairs in each line. Thanks,
Suren.
Agree on this.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Whatev. I'll drop this version from mm.git.
Thanks
Pan
Suren Baghdasaryan
maintainerQuoted 23 lines · Andrew Morton
Quoted 11 lines · On Thu, 11 Sep 2025 12:00:23 -0400 Usama Arif <[email protected]> wrote:
Quoted 3 lines
I think simply adding * to the end of function name or filename is sufficient as they are already str.
Instead of:
49152* 48*
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_createCould we do something like:
49152 48
arch/x86/kernel/cpu/mce/core.c:2709func:mce_device_create(inaccurate)Can we add another row, saying "the previous row was inaccurate"? I guess that would break parsers also.
I don't know if this was by design, but the present format does provide extensibility. It is basically
Quoted 7 lines
NNNN NNN name:value name:value
one could arguably append a third name:value and hope that authors of existing parsers figured this out.
Whatev. I'll drop this version from mm.git.
v2 is posted at:
https://lore.kernel.org/all/[email protected]/
Thanks!