Author: Remi Meier <remi.me...@gmail.com> Branch: nogil-unsafe-2 Changeset: r90508:0dd8add9e63b Date: 2017-03-03 14:42 +0100 http://bitbucket.org/pypy/pypy/changeset/0dd8add9e63b/
Log: change test so we don't spend most of the time doing minor GC before, we were spending most of the time making the huge chains of X-objects old. there was very little time spent by threads actually running in parallel. diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py --- a/rpython/memory/gc/incminimark.py +++ b/rpython/memory/gc/incminimark.py @@ -279,8 +279,8 @@ # allocated nursery size is 2 times "tl_block_size". # "cache_line_min" is used to round the actual thread-local # blocks to a cache line, to avoid pointless cache conflicts. - "tl_block_size": 65536, - "cache_line_min": 256, + "tl_block_size": 131072, + "cache_line_min": 256, # why not 64b? } def __init__(self, config, @@ -900,6 +900,11 @@ self.set_nursery_free(self.nursery_barriers.popleft()) self.set_nursery_top(self.nursery_barriers.popleft()) else: + # XXX: if we have more threads than nursery_size/block_size, + # the thread(s) not getting any blocks will immediately request + # a minor collection, even if the blocks of other threads are + # still mostly empty. + rgil.master_request_safepoint() # we are the only thread here; all others are in gc-safepoints diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -1442,8 +1442,10 @@ def bootstrap(): rthread.gc_thread_start() x = None - for i in range(100000): + for i in range(10000000): x = X(x) + if i % 10001 == 0: + x = None state.lock.acquire(True) os.write(1, "counter=%d\n" % state.counter) @@ -1458,7 +1460,7 @@ def entry_point(argv): os.write(1, "hello world\n") # start 5 new threads - TS = 100 + TS = int(argv[1]) state.lock = rthread.allocate_lock() state.counter = TS @@ -1467,7 +1469,7 @@ while True: time.sleep(0.1) - gc.collect() + #gc.collect() if state.counter == 0: break os.write(1, "all threads done\n") @@ -1475,7 +1477,7 @@ def runme(no__thread): t, cbuilder = self.compile(entry_point, no__thread=no__thread) - data = cbuilder.cmdexec('') + data = cbuilder.cmdexec('5') assert data.splitlines() == ['hello world', '1 ok', '2 ok', _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit