Index: libcfa/src/concurrency/ready_queue.cfa
===================================================================
--- libcfa/src/concurrency/ready_queue.cfa	(revision e84ab3dadc96fd4dc82b5b0bc20cfe9b14f64259)
+++ libcfa/src/concurrency/ready_queue.cfa	(revision 1f45c7df4a45479fa7e834a868fd6f3e589e7c0f)
@@ -67,7 +67,7 @@
 #endif
 
-static inline struct thread$ * try_pop(struct cluster * cltr, unsigned w __STATS(, __stats_readyQ_pop_t & stats));
-static inline struct thread$ * try_pop(struct cluster * cltr, unsigned i, unsigned j __STATS(, __stats_readyQ_pop_t & stats));
-static inline struct thread$ * search(struct cluster * cltr);
+static inline struct $thread * try_pop(struct cluster * cltr, unsigned w __STATS(, __stats_readyQ_pop_t & stats));
+static inline struct $thread * try_pop(struct cluster * cltr, unsigned i, unsigned j __STATS(, __stats_readyQ_pop_t & stats));
+static inline struct $thread * search(struct cluster * cltr);
 static inline [unsigned, bool] idx_from_r(unsigned r, unsigned preferred);
 
@@ -274,5 +274,5 @@
 //-----------------------------------------------------------------------
 #if defined(USE_CPU_WORK_STEALING)
-	__attribute__((hot)) void push(struct cluster * cltr, struct thread$ * thrd, bool push_local) with (cltr->ready_queue) {
+	__attribute__((hot)) void push(struct cluster * cltr, struct $thread * thrd, bool push_local) with (cltr->ready_queue) {
 		__cfadbg_print_safe(ready_queue, "Kernel : Pushing %p on cluster %p\n", thrd, cltr);
 
@@ -316,5 +316,5 @@
 
 	// Pop from the ready queue from a given cluster
-	__attribute__((hot)) thread$ * pop_fast(struct cluster * cltr) with (cltr->ready_queue) {
+	__attribute__((hot)) $thread * pop_fast(struct cluster * cltr) with (cltr->ready_queue) {
 		/* paranoid */ verify( lanes.count > 0 );
 		/* paranoid */ verify( kernelTLS().this_processor );
@@ -345,17 +345,10 @@
 			/* paranoid */ verify(lanes.count < 65536); // The following code assumes max 65536 cores.
 			/* paranoid */ verify(map.count < 65536); // The following code assumes max 65536 cores.
-			uint64_t chaos = __tls_rand();
-			uint64_t high_chaos = (chaos >> 32);
-			uint64_t  mid_chaos = (chaos >> 16) & 0xffff;
-			uint64_t  low_chaos = chaos & 0xffff;
-
-			unsigned me = map.self;
-			unsigned cpu_chaos = map.start + (mid_chaos % map.count);
-			bool global = cpu_chaos == me;
-
-			if(global) {
-				proc->rdq.target = high_chaos % lanes.count;
+
+			if(0 == (__tls_rand() % 10_000)) {
+				proc->rdq.target = __tls_rand() % lanes.count;
 			} else {
-				proc->rdq.target = (cpu_chaos * READYQ_SHARD_FACTOR) + (low_chaos % READYQ_SHARD_FACTOR);
+				unsigned cpu_chaos = map.start + (__tls_rand() % map.count);
+				proc->rdq.target = (cpu_chaos * READYQ_SHARD_FACTOR) + (__tls_rand() % READYQ_SHARD_FACTOR);
 				/* paranoid */ verify(proc->rdq.target >= (map.start * READYQ_SHARD_FACTOR));
 				/* paranoid */ verify(proc->rdq.target <  ((map.start + map.count) * READYQ_SHARD_FACTOR));
@@ -371,5 +364,5 @@
 				proc->rdq.target = -1u;
 				if(lanes.tscs[target].tv < cutoff && ts(lanes.data[target]) < cutoff) {
-					thread$ * t = try_pop(cltr, target __STATS(, __tls_stats()->ready.pop.help));
+					$thread * t = try_pop(cltr, target __STATS(, __tls_stats()->ready.pop.help));
 					proc->rdq.last = target;
 					if(t) return t;
@@ -379,5 +372,5 @@
 			unsigned last = proc->rdq.last;
 			if(last != -1u && lanes.tscs[last].tv < cutoff && ts(lanes.data[last]) < cutoff) {
-				thread$ * t = try_pop(cltr, last __STATS(, __tls_stats()->ready.pop.help));
+				$thread * t = try_pop(cltr, last __STATS(, __tls_stats()->ready.pop.help));
 				if(t) return t;
 			}
@@ -389,5 +382,5 @@
 		for(READYQ_SHARD_FACTOR) {
 			unsigned i = start + (proc->rdq.itr++ % READYQ_SHARD_FACTOR);
-			if(thread$ * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t;
+			if($thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t;
 		}
 
@@ -396,9 +389,9 @@
 	}
 
-	__attribute__((hot)) struct thread$ * pop_slow(struct cluster * cltr) with (cltr->ready_queue) {
+	__attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) with (cltr->ready_queue) {
 		processor * const proc = kernelTLS().this_processor;
 		unsigned last = proc->rdq.last;
 		if(last != -1u) {
-			struct thread$ * t = try_pop(cltr, last __STATS(, __tls_stats()->ready.pop.steal));
+			struct $thread * t = try_pop(cltr, last __STATS(, __tls_stats()->ready.pop.steal));
 			if(t) return t;
 			proc->rdq.last = -1u;
@@ -408,5 +401,5 @@
 		return try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal));
 	}
-	__attribute__((hot)) struct thread$ * pop_search(struct cluster * cltr) {
+	__attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) {
 		return search(cltr);
 	}
@@ -435,5 +428,5 @@
 	}
 
-	__attribute__((hot)) void push(struct cluster * cltr, struct thread$ * thrd, bool push_local) with (cltr->ready_queue) {
+	__attribute__((hot)) void push(struct cluster * cltr, struct $thread * thrd, bool push_local) with (cltr->ready_queue) {
 		__cfadbg_print_safe(ready_queue, "Kernel : Pushing %p on cluster %p\n", thrd, cltr);
 
@@ -482,5 +475,5 @@
 
 	// Pop from the ready queue from a given cluster
-	__attribute__((hot)) thread$ * pop_fast(struct cluster * cltr) with (cltr->ready_queue) {
+	__attribute__((hot)) $thread * pop_fast(struct cluster * cltr) with (cltr->ready_queue) {
 		/* paranoid */ verify( lanes.count > 0 );
 		/* paranoid */ verify( kernelTLS().this_processor );
@@ -506,5 +499,5 @@
 
 			// try popping from the 2 picked lists
-			struct thread$ * thrd = try_pop(cltr, i, j __STATS(, *(locali || localj ? &__tls_stats()->ready.pop.local : &__tls_stats()->ready.pop.help)));
+			struct $thread * thrd = try_pop(cltr, i, j __STATS(, *(locali || localj ? &__tls_stats()->ready.pop.local : &__tls_stats()->ready.pop.help)));
 			if(thrd) {
 				return thrd;
@@ -516,11 +509,11 @@
 	}
 
-	__attribute__((hot)) struct thread$ * pop_slow(struct cluster * cltr) { return pop_fast(cltr); }
-	__attribute__((hot)) struct thread$ * pop_search(struct cluster * cltr) {
+	__attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) { return pop_fast(cltr); }
+	__attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) {
 		return search(cltr);
 	}
 #endif
 #if defined(USE_WORK_STEALING)
-	__attribute__((hot)) void push(struct cluster * cltr, struct thread$ * thrd, bool push_local) with (cltr->ready_queue) {
+	__attribute__((hot)) void push(struct cluster * cltr, struct $thread * thrd, bool push_local) with (cltr->ready_queue) {
 		__cfadbg_print_safe(ready_queue, "Kernel : Pushing %p on cluster %p\n", thrd, cltr);
 
@@ -576,5 +569,5 @@
 
 	// Pop from the ready queue from a given cluster
-	__attribute__((hot)) thread$ * pop_fast(struct cluster * cltr) with (cltr->ready_queue) {
+	__attribute__((hot)) $thread * pop_fast(struct cluster * cltr) with (cltr->ready_queue) {
 		/* paranoid */ verify( lanes.count > 0 );
 		/* paranoid */ verify( kernelTLS().this_processor );
@@ -598,5 +591,5 @@
 			const unsigned long long cutoff = proc->rdq.cutoff > bias ? proc->rdq.cutoff - bias : proc->rdq.cutoff;
 			if(lanes.tscs[target].tv < cutoff && ts(lanes.data[target]) < cutoff) {
-				thread$ * t = try_pop(cltr, target __STATS(, __tls_stats()->ready.pop.help));
+				$thread * t = try_pop(cltr, target __STATS(, __tls_stats()->ready.pop.help));
 				if(t) return t;
 			}
@@ -605,15 +598,15 @@
 		for(READYQ_SHARD_FACTOR) {
 			unsigned i = proc->rdq.id + (proc->rdq.itr++ % READYQ_SHARD_FACTOR);
-			if(thread$ * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t;
+			if($thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t;
 		}
 		return 0p;
 	}
 
-	__attribute__((hot)) struct thread$ * pop_slow(struct cluster * cltr) with (cltr->ready_queue) {
+	__attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) with (cltr->ready_queue) {
 		unsigned i = __tls_rand() % lanes.count;
 		return try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal));
 	}
 
-	__attribute__((hot)) struct thread$ * pop_search(struct cluster * cltr) with (cltr->ready_queue) {
+	__attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) with (cltr->ready_queue) {
 		return search(cltr);
 	}
@@ -628,5 +621,5 @@
 //-----------------------------------------------------------------------
 // try to pop from a lane given by index w
-static inline struct thread$ * try_pop(struct cluster * cltr, unsigned w __STATS(, __stats_readyQ_pop_t & stats)) with (cltr->ready_queue) {
+static inline struct $thread * try_pop(struct cluster * cltr, unsigned w __STATS(, __stats_readyQ_pop_t & stats)) with (cltr->ready_queue) {
 	__STATS( stats.attempt++; )
 
@@ -651,5 +644,5 @@
 
 	// Actually pop the list
-	struct thread$ * thrd;
+	struct $thread * thrd;
 	unsigned long long tsv;
 	[thrd, tsv] = pop(lane);
@@ -678,5 +671,5 @@
 // try to pop from any lanes making sure you don't miss any threads push
 // before the start of the function
-static inline struct thread$ * search(struct cluster * cltr) with (cltr->ready_queue) {
+static inline struct $thread * search(struct cluster * cltr) with (cltr->ready_queue) {
 	/* paranoid */ verify( lanes.count > 0 );
 	unsigned count = __atomic_load_n( &lanes.count, __ATOMIC_RELAXED );
@@ -684,5 +677,5 @@
 	for(i; count) {
 		unsigned idx = (offset + i) % count;
-		struct thread$ * thrd = try_pop(cltr, idx __STATS(, __tls_stats()->ready.pop.search));
+		struct $thread * thrd = try_pop(cltr, idx __STATS(, __tls_stats()->ready.pop.search));
 		if(thrd) {
 			return thrd;
@@ -719,5 +712,5 @@
 //-----------------------------------------------------------------------
 // Given 2 indexes, pick the list with the oldest push an try to pop from it
-static inline struct thread$ * try_pop(struct cluster * cltr, unsigned i, unsigned j __STATS(, __stats_readyQ_pop_t & stats)) with (cltr->ready_queue) {
+static inline struct $thread * try_pop(struct cluster * cltr, unsigned i, unsigned j __STATS(, __stats_readyQ_pop_t & stats)) with (cltr->ready_queue) {
 	// Pick the bet list
 	int w = i;
@@ -854,5 +847,5 @@
 				// As long as we can pop from this lane to push the threads somewhere else in the queue
 				while(!is_empty(lanes.data[idx])) {
-					struct thread$ * thrd;
+					struct $thread * thrd;
 					unsigned long long _;
 					[thrd, _] = pop(lanes.data[idx]);
