• Andi Kleen's avatar
    [PATCH] x86: Add portable getcpu call · 3cfc348b
    Andi Kleen authored
    For NUMA optimization and some other algorithms it is useful to have a fast
    to get the current CPU and node numbers in user space.
    
    x86-64 added a fast way to do this in a vsyscall. This adds a generic
    syscall for other architectures to make it a generic portable facility.
    
    I expect some of them will also implement it as a faster vsyscall.
    
    The cache is an optimization for the x86-64 vsyscall optimization. Since
    what the syscall returns is an approximation anyways and user space
    often wants very fast results it can be cached for some time.  The norma
    methods to get this information in user space are relatively slow
    
    The vsyscall is in a better position to manage the cache because it has direct
    access to a fast time stamp (jiffies). For the generic syscall optimization
    it doesn't help much, but enforce a valid argument to keep programs
    portable
    
    I only added an i386 syscall entry for now. Other architectures can follow
    as needed.
    
    AK: Also added some cleanups from Andrew Morton
    Signed-off-by: default avatarAndi Kleen <ak@suse.de>
    3cfc348b
ia32entry.S 18.2 KB