Messages in this thread | | | Subject | Re: Faster getcpu() and sched_getcpu() | From | Andi Kleen <> | Date | Sun, 28 Sep 2008 18:42:54 +0200 |
| |
Pardo <pardo@google.com> writes: > > ANALYSIS AND SUGGESTIONS > > Caching is currently disabled for 2.6.26/arch/x86/vdso/vgetcpu.c. > getcpu()/sched_getcpu() performance is most important when they are > used very frequently, in which case the jiffy-based cache is > effective. Conversely, when calls are infrequent, cache miss overhead > is small. Recommendation: caching should be enabled (probably for all > architectures, not just x86-64).
Without a vsyscall the cache probably doesn't make too much sense because once you're in the kernel reading the real CPU number is really cheap.
I agree with you that the cache should be enabled on all vDSO implementations (that is what my original code did)
Also the TSCP version could probably go.
I'm still not sure why you say no redzone is that expensive? Do you have numbers? I know it's a few instructions, but it shouldn't be that expensive.
> A specialized version of the VDSO code for sched_getcpu() is > substantially faster than calling getcpu().
Yes, unfortunately glibc didn't chose the same interface as the kernel for this. I still don't know why. But now since we're in this mess specializing for the glibc implementation is probably a good idea. Or just add getcpu() to glibc :)
-Andi
-- ak@linux.intel.com
| |