Linux RSEQ Patches Updated For Allowing Faster getcpu() In C Libraries
Restartable Sequences "RSEQ" has been one of the nice additions to the Linux kernel in recent years and can allow for faster user-space operations on per-CPU data by providing a shared data structure ABI between each user-space thread and the kernel. RSEQ has been in the process of being extended to provide even more performance benefits.
RSEQ integration was (re)integrated earlier this year on the user-space side with Glibc 2.35 for making use of the Restartable Sequences system call for faster user-space operations on per-CPU data. RSEQ lead developer Mathieu Desnoyers has been more recently working on extending the kernel support to expose a NUMA node ID and virtual CPU ID extensions.
The NUMA node ID to be exposed by the pending RSEQ kernel patches will allow for implementing a faster getcpu() function within Glibc and any other C libraries. The getcpu() function, of course, being for determining the CPU and NUMA node of where a given thread is running.
The virtual CPU ID extensions being worked on as part of this patch series is for better scaling up or down of user-space per-CPU data structures. Desnoyers explains of that work, "The virtual cpu id allows ideal scaling (down or up) of user-space per-cpu data structures. The virtual cpu ids allocated within a memory space are tracked by the scheduler, which takes into account the number of concurrently running threads, thus implicitly considering the number of threads, the cpu affinity, the cpusets applying to those threads, and the number of logical cores on the system."
These latest RSEQ patches can be found on the kernel mailing list.
Mathieu Desnoyers earlier this month at Linux Plumbers Conference (LPC 2022) presented on this latest RSEQ work. There is this PDF slide deck from his presentation for those interested. There is also this slide deck for his second RSEQ presentation focused on use within containers.
RSEQ integration was (re)integrated earlier this year on the user-space side with Glibc 2.35 for making use of the Restartable Sequences system call for faster user-space operations on per-CPU data. RSEQ lead developer Mathieu Desnoyers has been more recently working on extending the kernel support to expose a NUMA node ID and virtual CPU ID extensions.
The NUMA node ID to be exposed by the pending RSEQ kernel patches will allow for implementing a faster getcpu() function within Glibc and any other C libraries. The getcpu() function, of course, being for determining the CPU and NUMA node of where a given thread is running.
The virtual CPU ID extensions being worked on as part of this patch series is for better scaling up or down of user-space per-CPU data structures. Desnoyers explains of that work, "The virtual cpu id allows ideal scaling (down or up) of user-space per-cpu data structures. The virtual cpu ids allocated within a memory space are tracked by the scheduler, which takes into account the number of concurrently running threads, thus implicitly considering the number of threads, the cpu affinity, the cpusets applying to those threads, and the number of logical cores on the system."
These latest RSEQ patches can be found on the kernel mailing list.
Mathieu Desnoyers earlier this month at Linux Plumbers Conference (LPC 2022) presented on this latest RSEQ work. There is this PDF slide deck from his presentation for those interested. There is also this slide deck for his second RSEQ presentation focused on use within containers.
7 Comments