]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/numa-util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 #include "cpu-set-util.h"
5 #include "missing_syscall.h"
7 static inline bool mpol_is_valid(int t
) {
8 return t
>= MPOL_DEFAULT
&& t
<= MPOL_LOCAL
;
11 typedef struct NUMAPolicy
{
12 /* Always use numa_policy_get_type() to read the value */
17 bool numa_policy_is_valid(const NUMAPolicy
*p
);
19 static inline int numa_policy_get_type(const NUMAPolicy
*p
) {
20 return p
->type
< 0 ? (p
->nodes
.set
? MPOL_PREFERRED
: -1) : p
->type
;
23 static inline void numa_policy_reset(NUMAPolicy
*p
) {
25 cpu_set_reset(&p
->nodes
);
29 int apply_numa_policy(const NUMAPolicy
*policy
);
30 int numa_to_cpu_set(const NUMAPolicy
*policy
, CPUSet
*set
);
32 int numa_mask_add_all(CPUSet
*mask
);
34 const char* mpol_to_string(int i
) _const_
;
35 int mpol_from_string(const char *s
) _pure_
;