The `jiffies` macro is used only in a single place in the time header.
Let's remove it and use the `jiffies64` function as is.
Also, `kernel_hz` sentinel value: 1 removed. This should be fine now
because `kernel_hz` property has been migrated to runtime configuration
and `division by zero` error can be caught at compile time.
Signed-off-by: viktor-kurchenko <viktor.kurchenko@isovalent.com>
static __u64 BPF_FUNC(ktime_get_ns);
static __u64 BPF_FUNC(ktime_get_boot_ns);
static __u64 BPF_FUNC(jiffies64);
-#define jiffies jiffies64()
/* We have cookies! ;-) */
static __sock_cookie BPF_FUNC(get_socket_cookie, void *ctx);
static __always_inline __u64 bpf_mono_now(void)
{
- if (CONFIG(enable_jiffies) && CONFIG(kernel_hz) != 1)
- return jiffies >> BPF_MONO_SCALER;
+ if (CONFIG(enable_jiffies))
+ return jiffies64() >> BPF_MONO_SCALER;
return bpf_ktime_get_sec();
}
static __always_inline __u32 bpf_sec_to_mono(__u32 s)
{
- if (CONFIG(enable_jiffies) && CONFIG(kernel_hz) != 1)
+ if (CONFIG(enable_jiffies))
return (__u32)(s * CONFIG(kernel_hz)) >> BPF_MONO_SCALER;
return s;
}
func initClockSourceOption(logger *slog.Logger) {
option.Config.ClockSource = option.ClockSourceKtime
- option.Config.KernelHz = 1 // Known invalid non-zero to avoid div by zero.
hz, err := probes.KernelHZ()
if err != nil {
logger.Info(