History

bpf: Add support for absolute value BPF timers

Add a new flag BPF_F_TIMER_ABS that can be passed to bpf_timer_start() to start an absolute value timer instead of the default relative value. This makes the timer expire at an exact point in time, instead of a time with latencies induced by both the BPF and timer subsystems.

Tero Kristo committed 3 years ago

Commit f71f8531 parent ec97a763 files · +39 −2Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/bpf.h+15−0
@@ -4969,6 +4969,12 @@ union bpf_attr { · 4968 unmodified lines
4969 * different maps if key/value layout matches across maps.4969 * different maps if key/value layout matches across maps.
4970 * Every bpf_timer_set_callback() can have different callback_fn.4970 * Every bpf_timer_set_callback() can have different callback_fn.
4971 *4971 *
4972 * *flags* can be one of:
4973 *
4974 * **BPF_F_TIMER_ABS**
4975 * Start the timer in absolute expire value instead of the
4976 * default relative one.
4977 *
4972 * Return4978 * Return
4973 * 0 on success.4979 * 0 on success.
4974 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier4980 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier
@@ -7097,4 +7103,13 @@ struct bpf_core_relo { · 2122 unmodified lines
7097 enum bpf_core_relo_kind kind;7103 enum bpf_core_relo_kind kind;
7098};7104};
7099 7105
7106/*
7107 * Flags to control bpf_timer_start() behaviour.
7108 * - BPF_F_TIMER_ABS: Timeout passed is absolute time, by default it is
7109 * relative to current time.
7110 */
7111enum {
7112 BPF_F_TIMER_ABS = (1ULL << 0),
7113};
7114
7100#endif /* _UAPI__LINUX_BPF_H__ */7115#endif /* _UAPI__LINUX_BPF_H__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t