with-gcing doesn't allow thread start

Bug #1595699 reported by Martin Cracauer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Undecided
Unassigned

Bug Description

As it is now, you cannot start threads when you are inside without-gcing.

It doesn't look like the code has too hard obstacles for this. Here is the appropriate section and the comment. <== HERE

(defun make-thread (function &key name arguments ephemeral)
[...]
        ;; If the starting thread is stopped for gc before it signals
        ;; the semaphore then we'd be stuck.
        (assert (not *gc-inhibit*)) <== HERE
        ;; Keep INITIAL-FUNCTION in the dynamic extent until the child
        ;; thread is initialized properly. Wrap the whole thing in
        ;; WITHOUT-INTERRUPTS because we pass INITIAL-FUNCTION to
        ;; another thread.
        (with-system-mutex (*make-thread-lock*)
          (if (zerop
               (%create-thread (get-lisp-obj-address #'initial-thread-function)))
              (setf thread nil)
              (wait-on-semaphore setup-sem)))))

This is a bugging me a bit since I like to run basic performance tests from the repl, and they get much more accurate without GC. It isn't so much the GCing itself that randomizes time, the problem is that the resulting placement new data is so random. Between TLB misses, cache line boundaries, assorted other alignments, NUMA and even paging it is overall better (not good, but better) do do no GC.

I currently work around this by setting gc-threshold very high. Looking for opinions or other people in the same situation.

Douglas Katzman (dougk)
Changed in sbcl:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.