Skip to content

Commit d7a73e3

Browse files
author
Kent Overstreet
committed
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 <[email protected]>
1 parent 04bc786 commit d7a73e3

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

include/linux/numa.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
#ifndef _LINUX_NUMA_H
33
#define _LINUX_NUMA_H
4+
#include <linux/init.h>
45
#include <linux/types.h>
56

67
#ifdef CONFIG_NODES_SHIFT
@@ -22,34 +23,26 @@
2223
#endif
2324

2425
#ifdef CONFIG_NUMA
25-
#include <linux/printk.h>
2626
#include <asm/sparsemem.h>
2727

2828
/* Generic implementation available */
2929
int numa_nearest_node(int node, unsigned int state);
3030

3131
#ifndef memory_add_physaddr_to_nid
32-
static inline int memory_add_physaddr_to_nid(u64 start)
33-
{
34-
pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n",
35-
start);
36-
return 0;
37-
}
32+
int memory_add_physaddr_to_nid(u64 start);
3833
#endif
34+
3935
#ifndef phys_to_target_node
40-
static inline int phys_to_target_node(u64 start)
41-
{
42-
pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
43-
start);
44-
return 0;
45-
}
36+
int phys_to_target_node(u64 start);
4637
#endif
38+
4739
#ifndef numa_fill_memblks
4840
static inline int __init numa_fill_memblks(u64 start, u64 end)
4941
{
5042
return NUMA_NO_MEMBLK;
5143
}
5244
#endif
45+
5346
#else /* !CONFIG_NUMA */
5447
static inline int numa_nearest_node(int node, unsigned int state)
5548
{

kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o
114114
obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o
115115
obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o
116116
obj-$(CONFIG_CFI_CLANG) += cfi.o
117+
obj-$(CONFIG_NUMA) += numa.o
117118

118119
obj-$(CONFIG_PERF_EVENTS) += events/
119120

kernel/numa.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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

0 commit comments

Comments
 (0)