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.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -4969,6 +4969,12 @@ union bpf_attr { · 4968 unmodified lines | ||
| 4969 | 4969 | * different maps if key/value layout matches across maps. |
| 4970 | 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 | 4978 | * Return |
| 4973 | 4979 | * 0 on success. |
| 4974 | 4980 | * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier |
| @@ -7097,4 +7103,13 @@ struct bpf_core_relo { · 2122 unmodified lines | ||
| 7097 | 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 | + */ | |
| 7111 | +enum { | |
| 7112 | + BPF_F_TIMER_ABS = (1ULL << 0), | |
| 7113 | +}; | |
| 7114 | + | |
| 7100 | 7115 | #endif /* _UAPI__LINUX_BPF_H__ */ |