Skip to content

Commit 86e50ab

Browse files
surenbaghdasaryanakpm00
authored andcommitted
arch/xtensa: always_inline get_current() and current_thread_info()
Mark get_current() and current_thread_info() functions as always_inline to fix the following modpost warning: WARNING: modpost: vmlinux: section mismatch in reference: get_current+0xc (section: .text.unlikely) -> initcall_level_names (section: .init.data) The warning happens when these functions are called from an __init function and they don't get inlined (remain in the .text section) while the value they return 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]> 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: Suren Baghdasaryan <[email protected]> Cc: Vincent Guittot <[email protected]> Cc: kernel test robot <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 5a5aa3c commit 86e50ab

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/xtensa/include/asm/current.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
struct task_struct;
2121

22-
static inline struct task_struct *get_current(void)
22+
static __always_inline struct task_struct *get_current(void)
2323
{
2424
return current_thread_info()->task;
2525
}

arch/xtensa/include/asm/thread_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct thread_info {
9191
}
9292

9393
/* how to get the thread information struct from C */
94-
static inline struct thread_info *current_thread_info(void)
94+
static __always_inline struct thread_info *current_thread_info(void)
9595
{
9696
struct thread_info *ti;
9797
__asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"

0 commit comments

Comments
 (0)