2

Jump label patching is a neat mechanism in the Linux kernel allowing for branch optimization. In general, some branches check a "static" condition which is not likely to change. One example for usage for this mechanism is in kernel tracing where an 'if' statement would check a variable in order to determine whether trace data should be emitted at a tracepoint. Instead of doing the compare and branch, enabling tracing would simply patch the 'if' statement an unconditional jump whereas disabling tracing would patch it to a a nop.

More here: https://lwn.net/Articles/412072/

I was wondering if this mechanism is also available in userspace. Apparently, all that is required is compiler and hardware support so there's no apparent reason why this would not be available for userspace as well.

smichak
  • 4,716
  • 3
  • 35
  • 47

0 Answers0