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.
3 Comments