summaryrefslogtreecommitdiff
path: root/tools/sched_ext/include/scx/features.bpf.h
blob: 992f4a74b277b3ac23f3a83ebf59c51b5d445737 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Kernel features the loader probes before load and hands to the BPF side in
 * one rodata word, so that a program can carry both the path a feature enables
 * and its fallback while the verifier prunes the one the running kernel cannot
 * take. scx_utils sets the word in the ops open macros. The bits are mirrored
 * in rust/scx_utils/src/compat.rs.
 *
 * Included by scx/common.bpf.h; don't include directly.
 *
 * Copyright (c) 2026 Meta Platforms, Inc. and affiliates.
 * Copyright (c) 2026 Tejun Heo <tj@kernel.org>
 */
#ifndef __SCX_FEATURES_BPF_H
#define __SCX_FEATURES_BPF_H

enum scx_lib_feature {
	/* the JIT lowers fetching AND, OR and XOR on arena pointers */
	SCX_LIB_FEAT_ARENA_FETCH_BITOPS		= 1ULL << 0,
};

const volatile u64 scx_lib_features __weak;

static __always_inline bool scx_lib_has(u64 feat)
{
	return scx_lib_features & feat;
}

#endif	/* __SCX_FEATURES_BPF_H */