bpf: Improve bucket_log calculation logic