Samy Al Bahra
0c56b1b8c6
ck_epoch: Remember to mark entry availability on unregister.
...
Pointed out by Matt Johnson (johnso87@crhc....>.
13 years ago
Samy Al Bahra
93684f77c1
ck_pr: Use CK_CC_INLINE instead of inline keyword for ck_pr_barrier.
13 years ago
Samy Al Bahra
de0597d2aa
ck_bitmap: Add comment for ck_bitmap_size.
13 years ago
Samy Al Bahra
849f938973
ck_ring: Add parameterized version of ck_ring_trydequeue.
13 years ago
Samy Al Bahra
7a99585f9e
ck_ring: No need for volatile load on dequeue_spmc.
13 years ago
Samy Al Bahra
01dc51db65
ck_ring: Add trydequeue variant.
13 years ago
Samy Al Bahra
ca8be0858c
ck_pr: Re-include port selection logic.
13 years ago
Samy Al Bahra
1c7b8811c8
ck_pr/gcc: Remove useless assignment from volatile load.
13 years ago
Samy Al Bahra
a9ed19303f
ck_pr/gcc: Adopt const semantics for load/store in GCC port.
13 years ago
Samy Al Bahra
6de54d6aa5
ck_pr/x86_64: Use correct target for load_64_2.
13 years ago
Samy Al Bahra
12da4128ff
ck_pr: Adopt const qualifer for load/store.
...
We will adopt these semantics for the rest of _ptr
family at some point in the future as well.
13 years ago
Samy Al Bahra
055a7fd5db
ck_ring: Add wrapper functions for parameterized SPMC ring.
13 years ago
Samy Al Bahra
68b33e56d8
ck_ring: Add parameterized version of SPMC ring.
13 years ago
Samy Al Bahra
7f35cbee1b
ck_ring: Use SPSC enqueue as SPMC enqueue.
13 years ago
Samy Al Bahra
5d1d850f44
ck_ring: Adopt semantics identical to spmc counter semantics.
13 years ago
Samy Al Bahra
77a3bd3126
ck_ring: Move overflow check to producer side.
...
unsigned int-sized counters will be used on producer
and consumer side. This is necessary to allow a ring
to be used on multiple workloads.
13 years ago
Samy Al Bahra
d595bafea7
ck_ring: Serialize producer snapshot with respect to consumer.
13 years ago
Samy Al Bahra
d705e02b76
ck_ring: Replace MPMC variant with SPMC variant for starters.
...
Immediate use-case is SPMC. Next is MPSC, then I will generalize
to MPMC (unfortunately, I don't have an algorithm that avoids CAS2
yet for MPMC).
13 years ago
Samy Al Bahra
bb48f602ff
ck_ring: Add note regarding correctness so people don't both verifying it.
...
Original version is susceptible to several problems, it is whack.
13 years ago
Samy Al Bahra
68e6752e53
ck_ring: Due to popular request, add MPMC variants of enqueue/dequeue.
...
Fencing semantics are heavier-weight than they need to be.
13 years ago
Samy Al Bahra
957e4aec5d
ck_brlock: Fix typo.
13 years ago
Samy Al Bahra
b631e3aa23
ck_brlock: Enable FAS serialization only on x86.
...
Other architectures, even TSO ones, pay a heavier flush
cost.
13 years ago
Samy Al Bahra
2bdc231288
ck_brlock: Serialize on atomic operation on read acquisition.
...
10% improvement for reader acquisition latency on TSO architectures
implementing wait-free FAS.
13 years ago
Samy Al Bahra
cb1c72d36b
ck_queue: Add CK_?LIST_MOVE operation.
...
This operation is of format:
CK_S*LIST_MOVE(a, b, linkage) and is equivalent to intializing
a with the contents of b. This is done in a manner that is atomic
with respect to readers. Read-only operations are still valid in
b, but behavior is undefined for write-side operations on b after
a MOVE operation.
13 years ago
Samy Al Bahra
5df8882840
ck_bytelock: Switch to full semantics on unlock.
...
RW semantics may be used for shared write-side.
13 years ago
Samy Al Bahra
a06f28b77c
ck_ring: Remove useless comment.
13 years ago
Samy Al Bahra
f3111b006b
ck_fifo: SPSC FIFO dequeue only requires load depends barrier.
13 years ago
Samy Al Bahra
bf30d3439c
ck_rwlock: Remove unncessary load fences, switch to full semantics on read unlock.
...
rwlock may also be used in SPMC workloads.
13 years ago
Samy Al Bahra
65ebf86799
ck_spinlock: Switch to full semantics across all implementations.
...
More importantly, trylock previously didn't have full semantics.
13 years ago
Samy Al Bahra
e40521d1aa
ck_pr/ppc64: Switch to RMO model for atomic operations.
...
Signed-off-by: Samy Al Bahra <sbahra@repnop.org>
13 years ago
Samy Al Bahra
6be03bb450
ck_bytelock: Remove unnecessary load barrier on unslotted read acquisition.
...
Signed-off-by: Samy Al Bahra <sbahra@repnop.org>
13 years ago
Samy Al Bahra
52ca64b2b7
ck_pr/sparcv9: MemIssue is overly heavyweight.
...
Signed-off-by: Samy Al Bahra <sbahra@repnop.org>
13 years ago
Samy Al Bahra
3f217c9789
ck_pr: Fallback to RMO for PSO for this release.
...
Barriers can be rejiggered next release.
13 years ago
Samy Al Bahra
a1dc38f20e
build/ck_pr: Add configurable memory models.
13 years ago
Samy Al Bahra
fedc2f6e47
ck_pr/sparcv9: Assume TSO by default.
13 years ago
Samy Al Bahra
690782aa67
ck_hs: Add hash function wrapper to maintain opacity of ck_hs_t.
...
This is in the form of CK_HS_HASH(X, Y, Z) which expands to
Y(Z, X.seed).
13 years ago
Samy Al Bahra
f2dfd828c3
Merge pull request #7 from abelmathew/master
...
CK_MD_VMA_BITS
13 years ago
Samy Al Bahra
ece2895e9e
ck_hs: Drop ck_hs_hash_t abstraction.
...
No need for opaque type anymore.
13 years ago
Abel Mathew
00d0320767
ck_bag: Fix usage of CK_MD_VMA_BITS.
13 years ago
Samy Al Bahra
adaf20b31c
ck_ht: Add ck_ht_stat function.
...
This can be used to expose certain performance metrics.
13 years ago
Samy Al Bahra
0f5e540afa
ck_hs: Lock-free set loosely modeled after ck_ht.
...
Currently only SPMC, but MPMC transformation is relatively trivial.
Documentation will come in a follow-up commit.
13 years ago
Abel Mathew
ec02b2f356
ck_bag: USE CK_BAG_KEY_LENGTH
13 years ago
Abel Mathew
9ff3c2d017
Merge remote-tracking branch 'upstream/master'
13 years ago
Abel Mathew
981e0a49a2
ck_bag: Use CK_MD_VMA_BITS
13 years ago
Samy Al Bahra
1d1e433dc4
ck_ht: Set unsigned key length.
13 years ago
Samy Al Bahra
ec0d212c04
ck_ht: Set artificial key length limit if pointer packing is disabled.
13 years ago
Samy Al Bahra
90713046e9
ck_ht: Use CK_MD_VMA_BITS.
...
Documentation update is necessary to point out CK_HT_KEY_LENGTH.
13 years ago
Samy Al Bahra
7a04c368ff
build: Add VMA bits detection for Mac OS X and Linux on x86*.
13 years ago
Samy Al Bahra
c45098b21b
ck_epoch: Emit fence instructions for TSO, do not emit for recursive calls.
...
Unfortunately, there are still workloads which will not
serialize. Recursive calls into ck_epoch_begin have no
need for fence instructions.
13 years ago
Samy Al Bahra
a5fb24ab61
ck_ht: Hard-code ck_ht_entry alignment.
...
Even though there is a re-write in progress, this issue must
be fixed. The CK_CC_ALIGNED attribute was never added.
13 years ago
Samy Al Bahra
f6a675ab00
ck_cc: Add no-op macros in case of unsupported compiler.
13 years ago
Samy Al Bahra
57104fcde7
ck_epoch: Change to epoch semantics, bump grace period to 4.
13 years ago
Samy Al Bahra
98d902b024
ck_epoch: Barrier placement for RMO.
13 years ago
Samy Al Bahra
c274e8bc54
ck_epoch: Major redesign and rewrite.
...
I had the pleasure of spending a significant amount of time at the most
recent LPC with Mathieu Desnoyers and Paul McKenney. In discussing
RCU semantics in relation to epoch reclamation, it was argued that
epoch reclamation is a specialisation of RCU (rather than a generalization).
In light of this discussion, I thought it would make more sense to not expose
write-side synchronization semantics aside from ck_epoch_call (similar to
RCU call), ck_epoch_poll (identical to tick), ck_epoch_barrier and
ck_epoch_synchronization (similar to ck_epoch_synchronization). Writers will
now longer have to use write-side epoch sections but can instead rely on
epoch_barrier/synchronization for blocking semantics and ck_epoch_poll
for old tick semantics.
One advantage of this is we can avoid write-side recursion for certain workloads.
Additionally, for infrequent writes, epoch_barrier and epoch_synchronization both
allow for blocking semantics to be used so you don't have to pay the cost of
epoch_entry for non-blocking dispatch.
Example usage:
e = stack_pop(mystack);
ck_epoch_synchronize(...);
free(e);
read_begin and read_end has been replaced with ck_epoch_begin and ck_epoch_end.
If multiple writers need SMR guarantees, then they can also use ck_epoch_begin
and ck_epoch_end. Any dispatch in presence of multiple writers should be done
with-in an epoch section (for now).
There are some follow-up commits to come.
13 years ago
Samy Al Bahra
955047a7d1
ck_{ring,fifo}: Add store fences while we lack load_store fences.
13 years ago
Samy Al Bahra
e78bbe9ae6
ck_{rw,byte,br}lock: Serialize final loads with respect to read.
...
I will switch to a SPARC-style barrier interface.
13 years ago
Samy Al Bahra
1d61147c01
ck_spinlock/mcs: Remove unnecessary fences, serialize unload.
13 years ago
Samy Al Bahra
79e336cfbc
ck_spinlock: Clarify ticket spinlock code.
...
Some people might be confused as far as lack of
fencing in the lock. Add a comment to clarify that
old values should not be equal to new values
of current position (where acquiring the current position
already has a global ordering).
13 years ago
Samy Al Bahra
27ed5f78fe
ck_spinlock: Remove unnecessary fence in DEC-based spinlock.
13 years ago
Samy Al Bahra
a7c4b9df65
ck_spinlock: Adopt RMO for anderson spinlock.
13 years ago
Samy Al Bahra
ce4cdd45c8
ck_spinlock: Adopt RMO semantics for CLH.
13 years ago
Samy Al Bahra
d72ca391f6
ck_bytelock: Switch to RMO model.
13 years ago
Samy Al Bahra
180b5e0386
ck_brlock: Serialize brlock operations for RMO.
13 years ago
Samy Al Bahra
45f310893c
ck_rwlock: Fix behavior for weakly-ordered systems.
...
As ck_pr semantics were still not molded, I was designing
under the assumption I would potentially go towards
acq/req interface. Since RMO will be the semantic norm for
the ck_pr model from now on, enforce stricter ordering
requirements on rwlock.
ck_rwlock_write_unlock function will now also serialize both
loads and stores.
13 years ago
Samy Al Bahra
8043f52130
ck_pr: Add ck_pr_barrier for compiler barrier.
...
CK_CC_BARRIER isn't idiomatic, roll this into PR memory model
instead.
13 years ago
Samy Al Bahra
1e8fe57028
ck_bitmap: Remove unnecessary whitespace.
13 years ago
Samy Al Bahra
bc19dccb1f
ck_cc: Add CK_CC_BARRIER for compiler barrier.
13 years ago
Samy Al Bahra
b1b19c1f74
ck_ring: Memory fence is overly pedantic for parameterized enqueue.
13 years ago
Samy Al Bahra
753f95fb45
Merge branch 'master' of git.concurrencykit.org:ck
13 years ago
Samy Al Bahra
94698736c1
ck_queue: Add appropriate load fences.
13 years ago
Samy Al Bahra
7530ca21b7
ck_fifo: Do not forget about node recycling.
13 years ago
Samy Al Bahra
2d2b49a313
ck_stack: Assume weak ordering of CAS.
...
I was actually unsure of the exact memory model
I wanted for atomic RMW operations. It was
made apparent with time that I had to adopt RMO
if I didn't want to sacrifice performance. Make
sure we can assume RMO for the stack.
13 years ago
Samy Al Bahra
a7f51fffca
ck_hp_fifo: Serialize second CAS.
13 years ago
Samy Al Bahra
ccbf28f0cb
ck_fifo: Remove unused variables, serialize MPMC insertion.
13 years ago
Samy Al Bahra
78f00eeeb6
ck_fifo_spsc: Fix implementation.
...
Do not be overly pedantic. Fix misplaced store
barrier and make sure to atomically load stub
pointer on reader side.
13 years ago
Samy Al Bahra
80c56d115b
ck_ring: Do not use volatile load for parametric ck_ring_size.
13 years ago
Samy Al Bahra
ad5e143bd5
ck_ring: Various improvements to readability.
...
No regressions in unit tests, so I'm dropping volatile
semantics for unnecessary volatile load/store on producer/consumer
side.
13 years ago
Samy Al Bahra
fbb88a519c
ck_bytelock: read_lock must serialize all load/store before checking owner field.
...
Thanks to Andrew Schorr for reporting the unit test failure.
13 years ago
Samy Al Bahra
3afa6b2b39
ck_ht: Let users define their own empty and tombstone values.
13 years ago
Samy Al Bahra
94c26494a6
ck_ring: Size is no longer necessary.
...
Patch submitted by Andrew Schorr.
13 years ago
Samy Al Bahra
7657df25a8
ck_sequence: Serialize read_begin, add load barrier.
13 years ago
Samy Al Bahra
031d950cc0
ck_stack: Add aliased attribute to ck_stack for GCC 4.4.
13 years ago
Samy Al Bahra
65cf506af9
ck_cc: Add CK_CC_ALIASED attribute.
...
Submitted by John Wittrock <jwittrock@...>.
13 years ago
Samy Al Bahra
7dd705c86f
ck_ht: Remove ck_ht_allocator_set declaration.
13 years ago
Samy Al Bahra
59158c824b
ck_ht: Do not re-hash on growth for non-PP case.
...
We already store the hash value in the hash table entry
if pointer packing is not enabled.
13 years ago
Samy Al Bahra
ccb1fd6d86
ck_fifo: Add some load fences for SPARC/PPC.
13 years ago
Samy Al Bahra
7d6626131d
ck_hp_fifo: Forgot load fence in last commit.
13 years ago
Samy Al Bahra
319872ca8c
ck_hp_fifo: Fix race condition on dequeue.
...
I accidentally swapped head/tail load in ck_hp_fifo (not in
ck_fifo, however). We must acquire head snapshot before tail snapshot.
An example execution history which could cause an incorrect update to occur
is below.
- tail <- fifo.tail / fifo.head != fifo.tail
- dequeue to empty (until final CAS which renders fifo.head = fifo.tail)
- head <- fifo.head / (head != tail)
- next <- fifo.head->next / next = NULL
- As head != tail, update to next pointer (where next is NULL).
However, if
- head <- fifo.head / (fifo.head != fifo.tail)
- dequeue to empty (until final CAS which renders fifo.head = fifo.tail)
- tail <- fifo.tail / fifo.head != fifo.tail
- next <- fifo.head->next / next = NULL
If we caught tail in final transition, the by the time we read next pointer,
head would have also changed forcing us to re-read. Thanks to Hendrik Donner
for reporting this.
13 years ago
Samy Al Bahra
72a8adb599
ck_ht: Add support for per-hash-table allocator.
...
Documentation and regressions tests have been updated to reflect this.
This functionality allows for individual hash tables use to different
allocation functions. Thanks to Wez Furlong for pointing out the necessary
documentation update for ck_ht.
13 years ago
Samy Al Bahra
314ce3ad81
ck_rwlock: Drop factor argument to trylock API.
...
Remove read-side recursion tests, it is an unsupported
feature to begin with.
13 years ago
Samy Al Bahra
512bbc050b
ck_rwlock: Add recursive trylock operations.
...
Unlike ck_rwlock, there is no spin factor associated with these.
13 years ago
Samy Al Bahra
380dd410c6
ck_backoff: Saturate geometric back-off.
...
A simple regression test has been added to verify this behavior.
13 years ago
Samy Al Bahra
18d74f55a1
ck_ht: Add support for user-specified hash functions.
13 years ago
Samy Al Bahra
606afe0f23
ck_rwlock: Add ck_rwlock_recursive facility.
...
Allows for write-side recurion. Added upon request by
other users. Regression test has been updated.
13 years ago
Samy Al Bahra
402c31ca9a
ck_hp_fifo: Add try{enqueue,dequeue} variants.
...
Regression test has been updated and passes.
13 years ago
Samy Al Bahra
816e11ff61
ck_fifo: Add tryenqueue/trydequeue wait-free operations.
...
Pending regressions tests, taking snapshot while I move to cafe.
13 years ago
Samy Al Bahra
286cc8b012
ck_hp_stack: Add trypush/trypop variants.
...
Regressions tests pending an update (taking a snaphot, A/C is down).
13 years ago
Samy Al Bahra
ff6f4d94f4
ck_stack: Add wait-free trypop and trypush operations.
...
Regression tests have been updated to test these operations as
equivalents to regular looping push/pop operations.
13 years ago
Samy Al Bahra
9446bc3e96
ck_stack: Get rid of default back-off behavior.
13 years ago
Samy Al Bahra
1cabea8a54
ck_hp_{fifo, stack}: Get rid of backoff behavior by default.
13 years ago