1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_SCHED_NUMA_BALANCING_H
3 #define _LINUX_SCHED_NUMA_BALANCING_H
4
5 /*
6 * This is the interface between the scheduler and the MM that
7 * implements memory access pattern based NUMA-balancing:
8 */
9
10 #include <linux/sched.h>
11
12 #define TNF_MIGRATED 0x01
13 #define TNF_NO_GROUP 0x02
14 #define TNF_SHARED 0x04
15 #define TNF_FAULT_LOCAL 0x08
16 #define TNF_MIGRATE_FAIL 0x10
17
18 #ifdef CONFIG_NUMA_BALANCING
19 extern void task_numa_fault(int last_node, int node, int pages, int flags);
20 extern pid_t task_numa_group_id(struct task_struct *p);
21 extern void set_numabalancing_state(bool enabled);
22 extern void task_numa_free(struct task_struct *p);
23 extern bool should_numa_migrate_memory(struct task_struct *p, struct page *page,
24 int src_nid, int dst_cpu);
25 #else
task_numa_fault(int last_node,int node,int pages,int flags)26 static inline void task_numa_fault(int last_node, int node, int pages,
27 int flags)
28 {
29 }
task_numa_group_id(struct task_struct * p)30 static inline pid_t task_numa_group_id(struct task_struct *p)
31 {
32 return 0;
33 }
set_numabalancing_state(bool enabled)34 static inline void set_numabalancing_state(bool enabled)
35 {
36 }
task_numa_free(struct task_struct * p)37 static inline void task_numa_free(struct task_struct *p)
38 {
39 }
should_numa_migrate_memory(struct task_struct * p,struct page * page,int src_nid,int dst_cpu)40 static inline bool should_numa_migrate_memory(struct task_struct *p,
41 struct page *page, int src_nid, int dst_cpu)
42 {
43 return true;
44 }
45 #endif
46
47 #endif /* _LINUX_SCHED_NUMA_BALANCING_H */
48