Skip to contentSkip to conversation

schedh-always_inline-alloc_tag_saverestore-to-fix-modpost-warnings.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Jul 9, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: sched.h: always_inline alloc_tag_{save|restore} to fix modpost warnings
has been removed from the -mm tree. Its filename was
schedh-always_inline-alloc_tag_saverestore-to-fix-modpost-warnings.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: sched.h: always_inline alloc_tag_{save|restore} to fix modpost warnings
Date: Thu, 4 Jul 2024 06:25:05 -0700

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.

Fixes 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
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]>

---

 include/linux/sched.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/sched.h renamed from include/linux/sched.h~schedh-always_inline-alloc_tag_saverestore-to-fix-modpost-warnings +2 -2
@@ -2192,13 +2192,13 @@ static inline int sched_core_idle_cpu(in
 extern void sched_set_stop_task(int cpu, struct task_struct *stop);
 
 #ifdef CONFIG_MEM_ALLOC_PROFILING
-static inline struct alloc_tag *alloc_tag_save(struct alloc_tag *tag)
+static __always_inline struct alloc_tag *alloc_tag_save(struct alloc_tag *tag)
 {
 	swap(current->alloc_tag, tag);
 	return tag;
 }
 
-static inline void alloc_tag_restore(struct alloc_tag *tag, struct alloc_tag *old)
+static __always_inline void alloc_tag_restore(struct alloc_tag *tag, struct alloc_tag *old)
 {
 #ifdef CONFIG_MEM_ALLOC_PROFILING_DEBUG
 	WARN(current->alloc_tag != tag, "current->alloc_tag was changed:\n");

_

Patches currently in -mm which might be from [email protected] are

mm-add-comments-for-allocation-helpers-explaining-why-they-are-macros.patch