24-28 August 2020
US/Pacific timezone

Evaluation of tail call costs in eBPF

24 Aug 2020, 09:00
Networking and BPF Summit/Virtual-Room (LPC 2020)

Networking and BPF Summit/Virtual-Room

LPC 2020

Networking & BPF Summit Networking and BPF Summit


Clément Joly (Cloudflare) François Serman


We would like to present results of an estimation of tail calls costs between eBPF programs. This was carried out for two kernel versions, 5.4 and 5.5. The latter introduces an optimization to remove the retpoline mitigating spectre flaws, in certain conditions. The numbers come from 2 benchmarks, executed over our eBPF software stack. The first one uses the in-kernel testing BPF_PROG_TEST_RUN. The second one uses kprobes, network namespaces and iperf3 to get figures from a production-like environment. The conditions to trigger the optimization from kernel 5.5 were met in both cases, resulting in a drop of the cost of one tail call from 20-30 ns to less than 10 ns.

More recent techniques to estimate CPU time cost of eBPF programs would be covered, as well as other improvements to the measurement system. At Cloudflare we have production deployment of eBPF programs with multiple tail calls. Thus, estimating and limiting the cost of these is important from a business perspective. As a result, examples of strategies used or considered to limit costs associated with tail calls would be outlined in the presentation too.

The desired outcome from the discussion is to get feedback on the methods deployed, both for benchmarks and to limit tail calls.

As this work is part of an internship for a master thesis, a paper would be written with the relevant elements of the thesis.

This would be a relatively short presentation, 20 minutes long, including questions.

I agree to abide by the anti-harassment policy I agree

Primary author

Clément Joly (Cloudflare)

Presentation Materials