Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernel/numa.c: Move logging out of numa.h

Moving these stub functions to a .c file means we can kill a sched.h
dependency on printk.h.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+33 -13
+6 -13
include/linux/numa.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 #ifndef _LINUX_NUMA_H 3 3 #define _LINUX_NUMA_H 4 + #include <linux/init.h> 4 5 #include <linux/types.h> 5 6 6 7 #ifdef CONFIG_NODES_SHIFT ··· 23 22 #endif 24 23 25 24 #ifdef CONFIG_NUMA 26 - #include <linux/printk.h> 27 25 #include <asm/sparsemem.h> 28 26 29 27 /* Generic implementation available */ 30 28 int numa_nearest_node(int node, unsigned int state); 31 29 32 30 #ifndef memory_add_physaddr_to_nid 33 - static inline int memory_add_physaddr_to_nid(u64 start) 34 - { 35 - pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", 36 - start); 37 - return 0; 38 - } 31 + int memory_add_physaddr_to_nid(u64 start); 39 32 #endif 33 + 40 34 #ifndef phys_to_target_node 41 - static inline int phys_to_target_node(u64 start) 42 - { 43 - pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", 44 - start); 45 - return 0; 46 - } 35 + int phys_to_target_node(u64 start); 47 36 #endif 37 + 48 38 #ifndef numa_fill_memblks 49 39 static inline int __init numa_fill_memblks(u64 start, u64 end) 50 40 { 51 41 return NUMA_NO_MEMBLK; 52 42 } 53 43 #endif 44 + 54 45 #else /* !CONFIG_NUMA */ 55 46 static inline int numa_nearest_node(int node, unsigned int state) 56 47 {
+1
kernel/Makefile
··· 114 114 obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o 115 115 obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o 116 116 obj-$(CONFIG_CFI_CLANG) += cfi.o 117 + obj-$(CONFIG_NUMA) += numa.o 117 118 118 119 obj-$(CONFIG_PERF_EVENTS) += events/ 119 120
+26
kernel/numa.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + 3 + #include <linux/printk.h> 4 + #include <linux/numa.h> 5 + 6 + /* Stub functions: */ 7 + 8 + #ifndef memory_add_physaddr_to_nid 9 + int memory_add_physaddr_to_nid(u64 start) 10 + { 11 + pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n", 12 + start); 13 + return 0; 14 + } 15 + EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); 16 + #endif 17 + 18 + #ifndef phys_to_target_node 19 + int phys_to_target_node(u64 start) 20 + { 21 + pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n", 22 + start); 23 + return 0; 24 + } 25 + EXPORT_SYMBOL_GPL(phys_to_target_node); 26 + #endif