Message ID | 20250313143002.9118-1-petr.pavlu@suse.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | codetag: Avoid unused alloc_tags sections/symbols | expand |
Context | Check | Description |
---|---|---|
mcgrof/vmtest-modules-next-VM_Test-1 | fail | Logs for Run CI tests |
mcgrof/vmtest-modules-next-PR | fail | PR summary |
mcgrof/vmtest-modules-next-VM_Test-3 | success | Logs for cleanup / Archive results and cleanup |
mcgrof/vmtest-modules-next-VM_Test-0 | fail | Logs for Run CI tests |
mcgrof/vmtest-modules-next-VM_Test-5 | success | Logs for setup / Setup kdevops environment |
mcgrof/vmtest-modules-next-VM_Test-2 | success | Logs for cleanup / Archive results and cleanup |
mcgrof/vmtest-modules-next-VM_Test-4 | success | Logs for setup / Setup kdevops environment |
On Thu, Mar 13, 2025 at 03:29:20PM +0100, Petr Pavlu wrote: > With CONFIG_MEM_ALLOC_PROFILING=n, vmlinux and all modules unnecessarily > contain the symbols __start_alloc_tags and __stop_alloc_tags, which define > an empty range. In the case of modules, the presence of these symbols also > forces the linker to create an empty .codetag.alloc_tags section. > > Update codetag.lds.h to make the data conditional on > CONFIG_MEM_ALLOC_PROFILING. > > Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev> > --- > include/asm-generic/codetag.lds.h | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/include/asm-generic/codetag.lds.h b/include/asm-generic/codetag.lds.h > index 372c320c5043..0ea1fa678405 100644 > --- a/include/asm-generic/codetag.lds.h > +++ b/include/asm-generic/codetag.lds.h > @@ -2,6 +2,12 @@ > #ifndef __ASM_GENERIC_CODETAG_LDS_H > #define __ASM_GENERIC_CODETAG_LDS_H > > +#ifdef CONFIG_MEM_ALLOC_PROFILING > +#define IF_MEM_ALLOC_PROFILING(...) __VA_ARGS__ > +#else > +#define IF_MEM_ALLOC_PROFILING(...) > +#endif > + > #define SECTION_WITH_BOUNDARIES(_name) \ > . = ALIGN(8); \ > __start_##_name = .; \ > @@ -9,7 +15,7 @@ > __stop_##_name = .; > > #define CODETAG_SECTIONS() \ > - SECTION_WITH_BOUNDARIES(alloc_tags) > + IF_MEM_ALLOC_PROFILING(SECTION_WITH_BOUNDARIES(alloc_tags)) > > /* > * Module codetags which aren't used after module unload, therefore have the > @@ -28,6 +34,6 @@ > * unload them individually once unused. > */ > #define MOD_SEPARATE_CODETAG_SECTIONS() \ > - MOD_SEPARATE_CODETAG_SECTION(alloc_tags) > + IF_MEM_ALLOC_PROFILING(MOD_SEPARATE_CODETAG_SECTION(alloc_tags)) > > #endif /* __ASM_GENERIC_CODETAG_LDS_H */ > > base-commit: 80e54e84911a923c40d7bee33a34c1b4be148d7a > -- > 2.43.0 >
On Thu, Mar 13, 2025 at 10:16 AM Kent Overstreet <kent.overstreet@linux.dev> wrote: > > On Thu, Mar 13, 2025 at 03:29:20PM +0100, Petr Pavlu wrote: > > With CONFIG_MEM_ALLOC_PROFILING=n, vmlinux and all modules unnecessarily > > contain the symbols __start_alloc_tags and __stop_alloc_tags, which define > > an empty range. In the case of modules, the presence of these symbols also > > forces the linker to create an empty .codetag.alloc_tags section. > > > > Update codetag.lds.h to make the data conditional on > > CONFIG_MEM_ALLOC_PROFILING. > > > > Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> > > Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev> Reviewed-by: Suren Baghdasaryan <surenb@google.com> > > > --- > > include/asm-generic/codetag.lds.h | 10 ++++++++-- > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/include/asm-generic/codetag.lds.h b/include/asm-generic/codetag.lds.h > > index 372c320c5043..0ea1fa678405 100644 > > --- a/include/asm-generic/codetag.lds.h > > +++ b/include/asm-generic/codetag.lds.h > > @@ -2,6 +2,12 @@ > > #ifndef __ASM_GENERIC_CODETAG_LDS_H > > #define __ASM_GENERIC_CODETAG_LDS_H > > > > +#ifdef CONFIG_MEM_ALLOC_PROFILING > > +#define IF_MEM_ALLOC_PROFILING(...) __VA_ARGS__ > > +#else > > +#define IF_MEM_ALLOC_PROFILING(...) > > +#endif > > + > > #define SECTION_WITH_BOUNDARIES(_name) \ > > . = ALIGN(8); \ > > __start_##_name = .; \ > > @@ -9,7 +15,7 @@ > > __stop_##_name = .; > > > > #define CODETAG_SECTIONS() \ > > - SECTION_WITH_BOUNDARIES(alloc_tags) > > + IF_MEM_ALLOC_PROFILING(SECTION_WITH_BOUNDARIES(alloc_tags)) > > > > /* > > * Module codetags which aren't used after module unload, therefore have the > > @@ -28,6 +34,6 @@ > > * unload them individually once unused. > > */ > > #define MOD_SEPARATE_CODETAG_SECTIONS() \ > > - MOD_SEPARATE_CODETAG_SECTION(alloc_tags) > > + IF_MEM_ALLOC_PROFILING(MOD_SEPARATE_CODETAG_SECTION(alloc_tags)) > > > > #endif /* __ASM_GENERIC_CODETAG_LDS_H */ > > > > base-commit: 80e54e84911a923c40d7bee33a34c1b4be148d7a > > -- > > 2.43.0 > >
diff --git a/include/asm-generic/codetag.lds.h b/include/asm-generic/codetag.lds.h index 372c320c5043..0ea1fa678405 100644 --- a/include/asm-generic/codetag.lds.h +++ b/include/asm-generic/codetag.lds.h @@ -2,6 +2,12 @@ #ifndef __ASM_GENERIC_CODETAG_LDS_H #define __ASM_GENERIC_CODETAG_LDS_H +#ifdef CONFIG_MEM_ALLOC_PROFILING +#define IF_MEM_ALLOC_PROFILING(...) __VA_ARGS__ +#else +#define IF_MEM_ALLOC_PROFILING(...) +#endif + #define SECTION_WITH_BOUNDARIES(_name) \ . = ALIGN(8); \ __start_##_name = .; \ @@ -9,7 +15,7 @@ __stop_##_name = .; #define CODETAG_SECTIONS() \ - SECTION_WITH_BOUNDARIES(alloc_tags) + IF_MEM_ALLOC_PROFILING(SECTION_WITH_BOUNDARIES(alloc_tags)) /* * Module codetags which aren't used after module unload, therefore have the @@ -28,6 +34,6 @@ * unload them individually once unused. */ #define MOD_SEPARATE_CODETAG_SECTIONS() \ - MOD_SEPARATE_CODETAG_SECTION(alloc_tags) + IF_MEM_ALLOC_PROFILING(MOD_SEPARATE_CODETAG_SECTION(alloc_tags)) #endif /* __ASM_GENERIC_CODETAG_LDS_H */
With CONFIG_MEM_ALLOC_PROFILING=n, vmlinux and all modules unnecessarily contain the symbols __start_alloc_tags and __stop_alloc_tags, which define an empty range. In the case of modules, the presence of these symbols also forces the linker to create an empty .codetag.alloc_tags section. Update codetag.lds.h to make the data conditional on CONFIG_MEM_ALLOC_PROFILING. Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> --- include/asm-generic/codetag.lds.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) base-commit: 80e54e84911a923c40d7bee33a34c1b4be148d7a