Show Your Support: This site is primarily supported by advertisements. Ads are what have allowed this site to be maintained on a daily basis for the past 18+ years. We do our best to ensure only clean, relevant ads are shown, when any nasty ads are detected, we work to remove them ASAP. If you would like to view the site without ads while still supporting our work, please consider our ad-free Phoronix Premium.
Linux 5.10 To See Static Calls For Helping Cases Where Retpolines Are Used
Worked on by Red Hat and others is static calls as a replacement to global function pointers in the kernel. Static calls rely on code patching to allow for direct calls to be used rather than indirect and yield better performance especially where Retpolines are otherwise used.
The pull for mainlining static calls in Linux 5.10 mentions, "This tree introduces static_call(), which is the idea of static_branch() applied to indirect function calls. Remove a data load (indirection) by modifying the text. They give the flexibility of function pointers, but with better performance...x86 is supported via text patching, otherwise basic indirect calls are used, with function pointers...The new APIs are utilized in the x86 perf code, a heavy user of function pointers, where static calls speed up the PMU handler by 4.2% (!)."
This patch outlines more of the technical details on the Linux kernel static calls implementation for those interested.