]>
Commit | Line | Data |
---|---|---|
1808f768 MS |
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
2 | #pragma once | |
3 | ||
4 | #include "cpu-set-util.h" | |
5 | #include "missing_syscall.h" | |
6 | ||
7 | static inline bool mpol_is_valid(int t) { | |
8 | return t >= MPOL_DEFAULT && t <= MPOL_LOCAL; | |
9 | } | |
10 | ||
11 | typedef struct NUMAPolicy { | |
12 | /* Always use numa_policy_get_type() to read the value */ | |
13 | int type; | |
14 | CPUSet nodes; | |
15 | } NUMAPolicy; | |
16 | ||
17 | bool numa_policy_is_valid(const NUMAPolicy *p); | |
18 | ||
19 | static inline int numa_policy_get_type(const NUMAPolicy *p) { | |
20 | return p->type < 0 ? (p->nodes.set ? MPOL_PREFERRED : -1) : p->type; | |
21 | } | |
22 | ||
23 | static inline void numa_policy_reset(NUMAPolicy *p) { | |
24 | assert(p); | |
25 | cpu_set_reset(&p->nodes); | |
26 | p->type = -1; | |
27 | } | |
28 | ||
29 | int apply_numa_policy(const NUMAPolicy *policy); | |
30 | int numa_to_cpu_set(const NUMAPolicy *policy, CPUSet *set); | |
31 | ||
32 | const char* mpol_to_string(int i) _const_; | |
33 | int mpol_from_string(const char *s) _pure_; |