Commit 5501b73
committed
Make FTP collections use adaptive_workers (not fixed num_workers)
Phase 6 step 3. With the controller state in place (commit b176751),
this commit wires it into the per-collection dispatch path:
_PyGC_GetParallelWorkers() now returns pool->adaptive_workers (the
random-walk-controlled value, updated after each collection) instead
of the configured pool->num_workers.
This is the FTP analogue of the GIL build's behaviour where each
dispatch site passes par_gc->adaptive_workers to _PyGC_DispatchAndWait.
The per-collection mechanism on FTP (_PyGCFTParState in
gc_free_threading.c::gc_collect_internal — used by update_refs,
mark_heap, propagate) creates a fresh worker set per collection and
sizes the page buckets accordingly. With this change, the worker count
varies per collection as adaptive_workers walks.
KNOWN INCOMPLETE: the persistent thread pool mechanism
(_PyGCThreadPool::workers, used for *_pool_work() worker functions)
still uses pool->num_workers directly via its barrier dispatch.
Making those scale too requires the per-worker condvar dispatch
refactor — the FTP analogue of Phase 5.3 on the GIL side. That's the
next commit; this one keeps things bisect-safe by leaving the pool
mechanism unchanged.
Verified: FTP build, all 5 parallel-GC test files pass (177 tests).
40-iteration smoke test completes without hang.1 parent 5ef3a61 commit 5501b73
1 file changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
532 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
533 | 539 | | |
534 | 540 | | |
535 | 541 | | |
536 | 542 | | |
537 | 543 | | |
538 | 544 | | |
539 | 545 | | |
540 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
541 | 554 | | |
542 | 555 | | |
543 | 556 | | |
| |||
0 commit comments