···155155 We do this here because otherwise user space would do it on156156 its own in a likely inferior way (no access to jiffies).157157 If you don't like it pass NULL. */158158- if (tcache && tcache->t0 == (j = __jiffies)) {159159- p = tcache->t1;158158+ if (tcache && tcache->blob[0] == (j = __jiffies)) {159159+ p = tcache->blob[1];160160 } else if (__vgetcpu_mode == VGETCPU_RDTSCP) {161161 /* Load per CPU data from RDTSCP */162162 rdtscp(dummy, dummy, p);···165165 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));166166 }167167 if (tcache) {168168- tcache->t0 = j;169169- tcache->t1 = p;168168+ tcache->blob[0] = j;169169+ tcache->blob[1] = p;170170 }171171 if (cpu)172172 *cpu = p & 0xfff;
+7-5
include/linux/getcpu.h
···11#ifndef _LINUX_GETCPU_H22#define _LINUX_GETCPU_H 13344-/* Cache for getcpu() to speed it up. Results might be upto a jiffie44+/* Cache for getcpu() to speed it up. Results might be a short time55 out of date, but will be faster.66+67 User programs should not refer to the contents of this structure.77- It is only a cache for vgetcpu(). It might change in future kernels.88+ I repeat they should not refer to it. If they do they will break99+ in future kernels.1010+1111+ It is only a private cache for vgetcpu(). It will change in future kernels.812 The user program must store this information per thread (__thread)913 If you want 100% accurate information pass NULL instead. */1014struct getcpu_cache {1111- unsigned long t0;1212- unsigned long t1;1313- unsigned long res[4];1515+ unsigned long blob[128 / sizeof(long)];1416};15171618#endif