summaryrefslogtreecommitdiff
path: root/includes/rts/Constants.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-01-22 16:49:11 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-01-22 16:49:11 +0000
commit65ac2f4cefcea7ca78a65ca22889b51b5a27d1f0 (patch)
treea841ea73d574bbda83eb387c8db530c342eb84e9 /includes/rts/Constants.h
parentf1d99ae043da2a4825d88756275477d82d92c967 (diff)
downloadhaskell-65ac2f4cefcea7ca78a65ca22889b51b5a27d1f0.tar.gz
When acquiring a spinlock, yieldThread() every 1000 spins (#3553, #3758)
This helps when the thread holding the lock has been descheduled, which is the main cause of the "last-core slowdown" problem. With this patch, I get much better results with -N8 on an 8-core box, although some benchmarks are still worse than with 7 cores. I also added a yieldThread() into the any_work() loop of the parallel GC when it has no work to do. Oddly, this seems to improve performance on the parallel GC benchmarks even when all the cores are busy. Perhaps it is due to reducing contention on the memory bus.
Diffstat (limited to 'includes/rts/Constants.h')
-rw-r--r--includes/rts/Constants.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/rts/Constants.h b/includes/rts/Constants.h
index 0aee60aa83..54a1ca71ca 100644
--- a/includes/rts/Constants.h
+++ b/includes/rts/Constants.h
@@ -296,4 +296,13 @@
#error RESERVED_STACK_WORDS may be wrong!
#endif
+/*
+ * The number of times we spin in a spin lock before yielding (see
+ * #3758). To tune this value, use the benchmark in #3758: run the
+ * server with -N2 and the client both on a dual-core. Also make sure
+ * that the chosen value doesn't slow down any of the parallel
+ * benchmarks in nofib/parallel.
+ */
+#define SPIN_COUNT 1000
+
#endif /* RTS_CONSTANTS_H */