]> git.baikalelectronics.ru Git - kernel.git/commit
rseq/membarrier: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
authorPeter Oskolkov <posk@google.com>
Wed, 23 Sep 2020 23:36:16 +0000 (16:36 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 25 Sep 2020 12:23:27 +0000 (14:23 +0200)
commit9f092b9f9fc8d693a394cca4ef4e3e835e853e44
treea4956fc970342eb2853b9e739009058504290676
parent003c46144bdb6f9252b66e89b4f4fabfdb367fd8
rseq/membarrier: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ

This patchset is based on Google-internal RSEQ work done by Paul
Turner and Andrew Hunter.

When working with per-CPU RSEQ-based memory allocations, it is
sometimes important to make sure that a global memory location is no
longer accessed from RSEQ critical sections. For example, there can be
two per-CPU lists, one is "active" and accessed per-CPU, while another
one is inactive and worked on asynchronously "off CPU" (e.g.  garbage
collection is performed). Then at some point the two lists are
swapped, and a fast RCU-like mechanism is required to make sure that
the previously active list is no longer accessed.

This patch introduces such a mechanism: in short, membarrier() syscall
issues an IPI to a CPU, restarting a potentially active RSEQ critical
section on the CPU.

Signed-off-by: Peter Oskolkov <posk@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lkml.kernel.org/r/20200923233618.2572849-1-posk@google.com
include/linux/sched/mm.h
include/linux/syscalls.h
include/uapi/linux/membarrier.h
kernel/sched/membarrier.c