> Andi Kleen used to lecture me every so often why it is important to > have fast vgetcpu on x86-64 (I don't think ia64 is excluded from > that). His lecture is also all over the lkml mailing list. I dug though that thread ... it isn't ever explicitly stated, but it does appear that the intent is that a NUMA aware application would use a malloc() library that called getcpu() on every memory allocation. If that is the usage model, then I'll agree that getcpu() does need to be fast. One possible way to achieve that on ia64 would be to make use of the fact that the ar.k* registers are readable by applications, and specifically ar.k3 contains a per-cpu value (physical address of the kernel percpu area). *IF* (and that is a BIG IF) we were to guarantee to maintain ar.k3 as a per-cpu unique value, then we could implement a very fast (even faster than fsys.S) getcpu() as: #define __NR_getcpu 1304 int getcpu(unsigned *cpup, unsigned *nodep, void *cachep) { static unsigned cpu = ~0, node = ~0; static unsigned long save_ar_k3; unsigned long ar_k3; asm volatile ("mov %0=ar.k3" : "=r" (ar_k3)); if (cpu == ~0 || ar_k3 != save_ar_k3) { if (syscall(__NR_getcpu, &cpu, &node, 0) == -1) return -1; save_ar_k3 = ar_k3; } *cpup = cpu; *nodep = node; return 0; } Too ugly for words? Or worth serious consideration? -Tony - To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |