diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-07-02 01:34:01 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-07-02 01:34:01 +0000 |
commit | 2277e32f451a4f2c2df9aa238a1ebc6e7d6e6993 (patch) | |
tree | ff697f8d41973078e583ab4e3ceabd929083ff04 /sys/arch/sparc64/include | |
parent | 2ccfb985fa190982dc0c9985889c6cfb80d7268d (diff) |
introduce srp, which according to the manpage i wrote is short for
"shared reference pointers".
srp allows concurrent access to a data structure by multiple cpus
while avoiding interlocking cpu opcodes. it manages its own reference
counts and the garbage collection of those data structure to avoid
use after frees.
internally srp is a twisted version of hazard pointers, which are
a relative of RCU.
jmatthew wrote the bulk of a hazard pointer implementation and
changed bpf to use it to allow mpsafe access to bpfilters. however,
at s2k15 we were trying to apply it to other data structures but
the memory overhead of every hazard pointer would have blown out
significantly in several uses cases. a bulk of our time at s2k15
was spent reworking hazard pointers into srp.
this diff adds the srp api and adds the necessary metadata to struct
cpuinfo on our MP architectures. srp on uniprocessor platforms has
alternate code that is optimised because it knows there'll be no
concurrent access to data by multiple cpus.
srp is made available to the system via param.h, so it should be
available everywhere in the kernel.
the docs likely need improvement cos im too close to the implementation.
ok mpi@
Diffstat (limited to 'sys/arch/sparc64/include')
-rw-r--r-- | sys/arch/sparc64/include/cpu.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h index d22cd775f14..aab6fb86ee9 100644 --- a/sys/arch/sparc64/include/cpu.h +++ b/sys/arch/sparc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.86 2014/10/15 21:54:13 sebastia Exp $ */ +/* $OpenBSD: cpu.h,v 1.87 2015/07/02 01:33:59 dlg Exp $ */ /* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */ /* @@ -118,6 +118,7 @@ struct cpu_info { int ci_upaid; #ifdef MULTIPROCESSOR int ci_itid; + struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; #endif int ci_node; u_int32_t ci_randseed; |