Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'likely-unlikely-for-bpf_helpers-and-a-small-comment-fix'

Anton Protopopov says:

====================
likely/unlikely for bpf_helpers and a small comment fix

These two commits fix a comment describing bpf_attr in <linux/bpf.h>
and add likely/unlikely macros to <bph/bpf_helpers.h> to be consumed
by selftests and, later, by the static_branch_likely/unlikely macros.

v1 -> v2:
* squash libbpf and selftests fixes into one patch (Andrii)
====================

Link: https://patch.msgid.link/20250331203618.1973691-1-a.s.protopopov@gmail.com
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

+10 -7
+1 -1
include/uapi/linux/bpf.h
··· 1506 1506 __s32 map_token_fd; 1507 1507 }; 1508 1508 1509 - struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ 1509 + struct { /* anonymous struct used by BPF_MAP_*_ELEM and BPF_MAP_FREEZE commands */ 1510 1510 __u32 map_fd; 1511 1511 __aligned_u64 key; 1512 1512 union {
+1 -1
tools/include/uapi/linux/bpf.h
··· 1506 1506 __s32 map_token_fd; 1507 1507 }; 1508 1508 1509 - struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ 1509 + struct { /* anonymous struct used by BPF_MAP_*_ELEM and BPF_MAP_FREEZE commands */ 1510 1510 __u32 map_fd; 1511 1511 __aligned_u64 key; 1512 1512 union {
+8
tools/lib/bpf/bpf_helpers.h
··· 15 15 #define __array(name, val) typeof(val) *name[] 16 16 #define __ulong(name, val) enum { ___bpf_concat(__unique_value, __COUNTER__) = val } name 17 17 18 + #ifndef likely 19 + #define likely(x) (__builtin_expect(!!(x), 1)) 20 + #endif 21 + 22 + #ifndef unlikely 23 + #define unlikely(x) (__builtin_expect(!!(x), 0)) 24 + #endif 25 + 18 26 /* 19 27 * Helper macro to place programs, maps, license in 20 28 * different sections in elf_bpf file. Section names
-3
tools/testing/selftests/bpf/bpf_arena_spin_lock.h
··· 95 95 #define _Q_LOCKED_VAL (1U << _Q_LOCKED_OFFSET) 96 96 #define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) 97 97 98 - #define likely(x) __builtin_expect(!!(x), 1) 99 - #define unlikely(x) __builtin_expect(!!(x), 0) 100 - 101 98 struct arena_qnode __arena qnodes[_Q_MAX_CPUS][_Q_MAX_NODES]; 102 99 103 100 static inline u32 encode_tail(int cpu, int idx)
-2
tools/testing/selftests/bpf/progs/iters.c
··· 7 7 #include "bpf_misc.h" 8 8 #include "bpf_compiler.h" 9 9 10 - #define unlikely(x) __builtin_expect(!!(x), 0) 11 - 12 10 static volatile int zero = 0; 13 11 14 12 int my_pid;