This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add getcpu


On 05/12/18 17:41, H.J. Lu wrote:
> On Wed, Dec 5, 2018 at 9:33 AM Carlos O'Donell <carlos@redhat.com> wrote:
>>
>> On 12/5/18 9:29 AM, H.J. Lu wrote:
>>> To optimize for multi-node NUMA system, I need a very fast way to identity which
>>> node the current process is running on.  getcpu:
>>>
>>> NAME
>>>        getcpu  -  determine  CPU  and NUMA node on which the calling thread is
>>>        running
...
>> I see that on x86 you have a vdso vgetcpu, and that lsl is one instruction and
>> loads the cpunode mask and ccpunode bits in one shot (atomic). So this should
>> work fine, but for all other callers I assume this will be a syscall.
> 
> I need vdso getcpu to avoid syscall.  I am working on a NUMA spinlock
> library which depends on a very fast getcpu.

hm i thought rseq will let you access cpuid faster than vdso.
(and that can even protect against preemptive scheduling.
i don't know much about numa, but i'd expect the cpuid to
numa node mapping to be fixed and then cpuid is enough)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]