* Linus Torvalds (torvalds@xxxxxxxxxxxxxxxxxxxx) wrote: > > > On Fri, 25 Apr 2008, H. Peter Anvin wrote: > > > > Yes, that should work. It's still ugly, and I have to say I find the > > complexity rather distasteful. I am willing to be convinced it's worth it, > > but I would really like to see hard numbers. > > I really cannot imagine that this kind of pain is *ever* worth it. > > Please give an example of something so important that we'd want to do > complex code rewriting on the fly. What _is_ the point of imv_cond()? > > Linus The point is to provide a way to dynamically enable code at runtime without noticeable performance impact on the system. It's principally useful to control the markers in the kernel, which can be placed in very frequently executed code paths. The original markers add a memory read, test and conditional branch at each marker site. By using the immediate values patchset, it goes down to a load immediate value, test and branch. However, Ingo was still unhappy with the conditional branch, so I cooked this jump patching optimization on top of the immediate values. It looks for an expected pattern which limits the liveliness of the %al and ZF registers to the 3 instructions and, if it finds it, patches a jump located just before the mov instruction to skip the whole pattern and behave exactly like the conditional branch. So basically we get code dynamically actvated by patching a single jump. Mathieu -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html