{"push_id":723320212,"size":1,"distinct_size":1,"ref":"refs/heads/getcpu-cache","head":"bb4ab4164ac0cc6da60ff3180b29ec5a2ddd2590","before":"1c92334f13106556c7335a46b34fc47e802dc41f","commits":[{"sha":"bb4ab4164ac0cc6da60ff3180b29ec5a2ddd2590","author":{"email":"007bef6a47fb57dff675bfa1b0b798b4bdfbfc25@efficios.com","name":"Mathieu Desnoyers"},"message":"getcpu_cache system call: caching current CPU number (x86)\n\nExpose a new system call allowing threads to register a userspace memory\narea where to store the current CPU number. Scheduler migration sets the\nTIF_NOTIFY_RESUME flag on the current thread. Upon return to user-space,\na notify-resume handler updates the current CPU value within that\nuser-space memory area.\n\nThis getcpu cache is an alternative to the sched_getcpu() vdso which has\na few benefits:\n- It is faster to do a memory read that to call a vDSO,\n- This cache value can be read from within an inline assembly, which\n  makes it a useful building block for restartable sequences.\n\nThis approach is inspired by Paul Turner and Andrew Hunter's work\non percpu atomics, which lets the kernel handle restart of critical\nsections:\nRef.:\n* https://lkml.org/lkml/2015/6/24/665\n* https://lwn.net/Articles/650333/\n* http://www.linuxplumbersconf.org/2013/ocw/system/presentations/1695/original/LPC%20-%20PerCpu%20Atomics.pdf\n\nBenchmarking sched_getcpu() vs tls cache approach. Getting the\ncurrent CPU number:\n\n- With Linux vdso:            12.7 ns\n- With TLS-cached cpu number:  0.3 ns\n\nSigned-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>\nCC: Paul Turner <pjt@google.com>\nCC: Andrew Hunter <ahh@google.com>\nCC: Peter Zijlstra <peterz@infradead.org>\nCC: Ingo Molnar <mingo@redhat.com>\nCC: Ben Maurer <bmaurer@fb.com>\nCC: Steven Rostedt <rostedt@goodmis.org>\nCC: \"Paul E. McKenney\" <paulmck@linux.vnet.ibm.com>\nCC: Josh Triplett <josh@joshtriplett.org>\nCC: Lai Jiangshan <laijs@cn.fujitsu.com>\nCC: Linus Torvalds <torvalds@linux-foundation.org>\nCC: Andrew Morton <akpm@linux-foundation.org>\nCC: linux-api@vger.kernel.org","distinct":true,"url":"https://api.github.com/repos/compudj/linux-percpu-dev/commits/bb4ab4164ac0cc6da60ff3180b29ec5a2ddd2590"}]}