Skip to content

Commit 5a5aa3c

Browse files
surenbaghdasaryanakpm00
authored andcommitted
sched.h: always_inline alloc_tag_{save|restore} to fix modpost warnings
Mark alloc_tag_{save|restore} as always_inline to fix the following modpost warnings: WARNING: modpost: vmlinux: section mismatch in reference: alloc_tag_save+0x1c (section: .text.unlikely) -> initcall_level_names (section: .init.data) WARNING: modpost: vmlinux: section mismatch in reference: alloc_tag_restore+0x3c (section: .text.unlikely) -> initcall_level_names (section: .init.data) The warnings happen when these functions are called from an __init function and they don't get inlined (remain in the .text section) while the value returned by get_current() points into .init.data section. Assuming get_current() always returns a valid address, this situation can happen only during init stage and accessing .init.data from .text section during that stage should pose no issues. Link: https://lkml.kernel.org/r/20240704132506.1011978-1-surenb@google.com Fixes: 22d407b ("lib: add allocation tagging support for memory allocation profiling") Signed-off-by: Suren Baghdasaryan <surenb@google.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202407032306.gi9nZsBi-lkp@intel.com/ Cc: Kent Overstreet <kent.overstreet@linux.dev> Cc: Chris Zankel <chris@zankel.net> Cc: Ingo Molnar <mingo@redhat.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1e3d28f commit 5a5aa3c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

include/linux/sched.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,13 +2192,13 @@ static inline int sched_core_idle_cpu(int cpu) { return idle_cpu(cpu); }
21922192
extern void sched_set_stop_task(int cpu, struct task_struct *stop);
21932193

21942194
#ifdef CONFIG_MEM_ALLOC_PROFILING
2195-
static inline struct alloc_tag *alloc_tag_save(struct alloc_tag *tag)
2195+
static __always_inline struct alloc_tag *alloc_tag_save(struct alloc_tag *tag)
21962196
{
21972197
swap(current->alloc_tag, tag);
21982198
return tag;
21992199
}
22002200

2201-
static inline void alloc_tag_restore(struct alloc_tag *tag, struct alloc_tag *old)
2201+
static __always_inline void alloc_tag_restore(struct alloc_tag *tag, struct alloc_tag *old)
22022202
{
22032203
#ifdef CONFIG_MEM_ALLOC_PROFILING_DEBUG
22042204
WARN(current->alloc_tag != tag, "current->alloc_tag was changed:\n");

0 commit comments

Comments
 (0)