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/[email protected] Fixes: 22d407b ("lib: add allocation tagging support for memory allocation profiling") Signed-off-by: Suren Baghdasaryan <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Cc: Kent Overstreet <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Max Filippov <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Vincent Guittot <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1e3d28f commit 5a5aa3c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)