Granary / granary2

Dynamic binary translation framework for instrumenting x86-64 user space Linux programs
MIT License
39 stars 5 forks source link

Handle unlikely branch specialization via Jump Labels #12

Open pgoodman opened 10 years ago

pgoodman commented 10 years ago

The Linux kernel has a jump_label type that is used as part of very rarely satisfied conditions. To optimize the common case, the kernel dynamically specializes its own code by marking what branches to specialize with struct jump_labels and then dynamically patching those branches to be unconditional.

The jump_label mechanism is described here and here.

pgoodman commented 10 years ago

See the text_mutex, as it relates to dynamic code patching.