* Andi Kleen <[EMAIL PROTECTED]> wrote: > Some CPUs like K8 cannot predict indirect calls. A common optimization > in object oriented languages is to check for the most common call > target and then call it directly; otherwise do an indirect call. This > patch does this manually for sched_fair calls in sched.c [...]
> I unfortunately wasn't able to measure a consistent difference in > lmbench3 lat_ctx -- the change seems to be below its (large) > instability. > + * Simple devirtualization: > + * Most tasks are fair tasks. Avoid the overhead of > + * doing indirect calls for them by checking for the fair case and doing > + * a direct call. Use only in real fast paths since it generates larger code. > + */ > +#define __CLASS_CALL(class, name, args) \ > + ((class) == &fair_sched_class ? \ > + name ## _fair args : (class)->name args) > +#define CLASS_CALL(p, name, args) \ > + __CLASS_CALL((p)->sched_class, name, args) hm, i'm not convinced about this one. It increases the code size a bit and it's a sched.c local hack. If then this should be done on a generic infrastructure level - lots of other code (VFS, networking, etc.) could benefit from it i suspect - and then should be .configurable as well. Then the benefit might become measurable too. Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/