History

[PATCH] x86: Add portable getcpu call

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

Andi Kleen committed 20 years ago

Commit 3cfc3481 parent c08c8205 files · +37 −1Browse files

Showing the changes to arch (2 of 5 files). Show all

Unified · Split

2 files
  1. arch/i386/kernel/syscall_table.S +1 −0
  2. arch/x86_64/ia32/ia32entry.S +1 −0
arch/i386/kernel/syscall_table.S+1−0
@@ -317,3 +317,4 @@ ENTRY(sys_call_table) · 316 unmodified lines
317317 .long sys_tee /* 315 */
318318 .long sys_vmsplice
319319 .long sys_move_pages
320+ .long sys_getcpu
arch/x86_64/ia32/ia32entry.S+1−0
@@ -713,4 +713,5 @@ ia32_sys_call_table: · 712 unmodified lines
713713 .quad sys_tee
714714 .quad compat_sys_vmsplice
715715 .quad compat_sys_move_pages
716+ .quad sys_getcpu
716717 ia32_syscall_end: