cpython/Include/internal
Miss Islington (bot) 6a2a2906f8
Some checks are pending
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
[3.14] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (#135912)
The free threading build uses QSBR to delay the freeing of dictionary
keys and list arrays when the objects are accessed by multiple threads
in order to allow concurrent reads to proceed with holding the object
lock. The requests are processed in batches to reduce execution
overhead, but for large memory blocks this can lead to excess memory
usage.

Take into account the size of the memory block when deciding when to
process QSBR requests.

Also track the amount of memory being held by QSBR for mimalloc pages.  Advance the write sequence if this memory exceeds a limit.  Advancing the sequence will allow it to be freed more quickly.

Process the held QSBR items from the "eval breaker", rather than from `_PyMem_FreeDelayed()`.  This gives a higher chance that the global read sequence has advanced enough so that items can be freed.

(cherry picked from commit 113de8545f)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-07-08 10:58:01 -07:00
..
mimalloc [3.14] Doc: fix duplicated words (GH-136086) (#136108) 2025-06-29 18:45:26 -04:00
pycore_abstract.h
pycore_asdl.h
pycore_ast.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_ast_state.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_atexit.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_audit.h
pycore_backoff.h gh-131238: Move pycore_obmalloc.h include to pycore_runtime_structs.h (#131482) 2025-03-19 23:32:30 +00:00
pycore_bitutils.h
pycore_blocks_output_buffer.h
pycore_brc.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_bytes_methods.h
pycore_bytesobject.h [3.14] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133942) 2025-05-13 16:25:08 +03:00
pycore_c_array.h gh-130080: move _Py_EnsureArrayLargeEnough to a separate header so it can be used outside of the compiler (#130930) 2025-03-13 16:02:58 +00:00
pycore_call.h gh-131238: Remove pycore_runtime.h from pycore_pystate.h (#131356) 2025-03-19 17:33:24 +01:00
pycore_capsule.h
pycore_cell.h gh-123358: Use _PyStackRef in LOAD_DEREF (gh-130064) 2025-03-26 12:08:20 -04:00
pycore_ceval.h [3.14] gh-135755: Move SPECIAL_ constants to a private header (GH-135922) (GH-135926) 2025-06-25 13:36:46 +02:00
pycore_ceval_state.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_code.h [3.14] gh-132775: Unrevert "Add _PyCode_VerifyStateless()" (gh-133625) 2025-05-08 00:00:33 +00:00
pycore_codecs.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_compile.h gh-126835: Rename ast_opt.c to ast_preprocess.c and related stuff after moving const folding to the peephole optimizier (#131830) 2025-05-04 21:07:35 +03:00
pycore_complexobject.h gh-128813: hide mixed-mode functions for complex arithmetic from C-API (#131703) 2025-04-22 14:18:18 +02:00
pycore_condvar.h gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) 2025-03-11 12:33:01 +01:00
pycore_context.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_critical_section.h gh-131238: Remove pycore_lock.h includes (#131483) 2025-03-19 23:46:25 +00:00
pycore_crossinterp.h [3.14] gh-132775: Clean Up Cross-Interpreter Error Handling (gh-135492) 2025-06-14 02:08:25 +00:00
pycore_crossinterp_data_registry.h [3.14] gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-134418) 2025-05-21 14:47:56 +00:00
pycore_debug_offsets.h [3.14] gh-131591: Add Py_ prefix to MAX_SCRIPT_PATH_SIZE; remove unprefixed struct tag (GH-135924) (GH-135969) 2025-06-26 10:23:39 +02:00
pycore_descrobject.h
pycore_dict.h [3.14] gh-132641: fix race in lru_cache under free-threading (GH-133787) (#133979) 2025-05-14 07:11:38 +00:00
pycore_dict_state.h
pycore_dtoa.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_emscripten_signal.h
pycore_emscripten_trampoline.h gh-132097: use a macro for semantically casting function pointers (#132406) 2025-04-18 12:24:34 +02:00
pycore_exceptions.h gh-129668: Fix thread-safety of MemoryError freelist in free threaded build (gh-129704) 2025-02-06 12:38:12 -05:00
pycore_faulthandler.h gh-127604: Add C stack dumps to faulthandler (#128159) 2025-04-21 20:48:02 +01:00
pycore_fileutils.h gh-131238: Use pycore_interp_structs.h header (#131481) 2025-03-19 23:13:25 +00:00
pycore_fileutils_windows.h
pycore_floatobject.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_flowgraph.h
pycore_format.h
pycore_frame.h gh-130704: Strength reduce LOAD_FAST{_LOAD_FAST} (#130708) 2025-04-01 10:18:42 -07:00
pycore_freelist.h gh-131238: Remove includes from pycore_interp.h (#131495) 2025-03-20 11:35:23 +00:00
pycore_freelist_state.h gh-126703: Add freelist for range and range_iter objects (GH-128619) 2025-04-07 04:40:52 +08:00
pycore_function.h [3.14] gh-135755: Move PyFunction_GET_BUILTINS to the private API (GH-135938) (GH-135972) 2025-06-26 10:08:28 +00:00
pycore_gc.h gh-131238: Move _Py_VISIT_STACKREF() to pycore_stackref.h (#131560) 2025-03-21 23:24:14 +01:00
pycore_genobject.h gh-131238: Move _Py_VISIT_STACKREF() to pycore_stackref.h (#131560) 2025-03-21 23:24:14 +01:00
pycore_getopt.h
pycore_gil.h
pycore_global_objects.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_global_objects_fini_generated.h [3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080) 2025-06-28 19:12:54 +01:00
pycore_global_strings.h [3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080) 2025-06-28 19:12:54 +01:00
pycore_hamt.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_hashtable.h
pycore_import.h gh-132775: Drop PyUnstable_InterpreterState_GetMainModule() (gh-132978) 2025-04-28 12:46:22 -06:00
pycore_importdl.h
pycore_index_pool.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_initconfig.h gh-130931: Add pycore_typedefs.h internal header (#131396) 2025-03-19 15:23:32 +01:00
pycore_instruction_sequence.h gh-130907: Treat all module-level annotations as conditional (#131550) 2025-04-28 06:10:28 -07:00
pycore_instruments.h gh-130931: Add pycore_typedefs.h internal header (#131396) 2025-03-19 15:23:32 +01:00
pycore_interp.h gh-131238: Remove includes from pycore_interp.h (#131495) 2025-03-20 11:35:23 +00:00
pycore_interp_structs.h [3.14] gh-91048: Refactor and optimize remote debugging module (#134652) (#134673) 2025-05-25 22:10:20 +00:00
pycore_interpframe.h GH-132508: Use tagged integers on the evaluation stack for the last instruction offset (GH-132545) 2025-04-29 18:00:35 +01:00
pycore_interpframe_structs.h gh-131238: Add pycore_interpframe_structs.h header (#131553) 2025-03-21 17:19:47 +00:00
pycore_interpolation.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_intrinsics.h
pycore_jit.h GH-131498: Remove conditional stack effects (GH-131499) 2025-03-20 15:39:38 +00:00
pycore_list.h gh-100239: specialize BINARY_OP/SUBSCR for list-slice (#132626) 2025-05-01 10:28:52 +00:00
pycore_llist.h
pycore_lock.h gh-128002: use per threads tasks linked list in asyncio (#128869) 2025-02-06 19:51:07 +01:00
pycore_long.h [3.14] gh-133583: Add support for fixed size unsigned integers in argument parsing (GH-133584) (GH-133650) 2025-05-08 09:54:44 +00:00
pycore_magic_number.h [3.14] gh-134889: Fix handling of a few opcodes when optimizing LOAD_FAST (#134958) (#135187) 2025-06-05 13:06:51 -07:00
pycore_memoryobject.h gh-132776: Revert Moving memoryview XIData Code to memoryobject.c (gh-132960) 2025-04-25 16:43:50 +00:00
pycore_mimalloc.h
pycore_modsupport.h gh-112136: Remove unused #include "pycore_lock.h" (#127093) 2024-11-21 13:50:11 +01:00
pycore_moduleobject.h gh-132775: Add _PyModule_GetFilenameObject() and _PyModule_GetFilenameUTF8() (gh-132979) 2025-04-28 12:41:32 -06:00
pycore_namespace.h
pycore_object.h [3.14] gh-135906: Use _PyObject_CAST in internal headers (GH-135892) (GH-136392) 2025-07-07 17:21:28 +00:00
pycore_object_alloc.h
pycore_object_deferred.h
pycore_object_stack.h
pycore_object_state.h
pycore_obmalloc.h
pycore_obmalloc_init.h
pycore_opcode_metadata.h [3.14] gh-128045: Mark unknown opcodes as deopting to themselves (GH-128044) (#134228) 2025-05-19 11:09:15 -04:00
pycore_opcode_utils.h [3.14] gh-132775: Unrevert "Add _PyCode_VerifyStateless()" (gh-133625) 2025-05-08 00:00:33 +00:00
pycore_optimizer.h GH-133231: Changes to executor management to support proposed sys._jit module (GH-133287) 2025-05-04 10:05:35 +01:00
pycore_parking_lot.h
pycore_parser.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_pathconfig.h
pycore_pyarena.h
pycore_pyatomic_ft_wrappers.h gh-131757: allow lru_cache functions to execute concurrently (#131758) 2025-04-14 18:31:19 +02:00
pycore_pybuffer.h
pycore_pyerrors.h [3.14] gh-132775: Use _PyFunction_VerifyStateless() and _PyCode_VerifyStateless() (gh-134465) 2025-05-21 20:43:29 +00:00
pycore_pyhash.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_pylifecycle.h gh-131238: Cleanup pycore_runtime.h includes (#131486) 2025-03-20 00:47:30 +00:00
pycore_pymath.h
pycore_pymem.h [3.14] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (#135912) 2025-07-08 10:58:01 -07:00
pycore_pymem_init.h
pycore_pystate.h [3.14] gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928) (#136173) 2025-07-01 13:44:32 +00:00
pycore_pystats.h
pycore_pythonrun.h [3.14] gh-130396: Move PYOS_LOG2_STACK_MARGIN to internal headers (GH-135928) (#136173) 2025-07-01 13:44:32 +00:00
pycore_pythread.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_qsbr.h [3.14] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (#135912) 2025-07-08 10:58:01 -07:00
pycore_range.h
pycore_runtime.h gh-131238: Use pycore_interp_structs.h header (#131481) 2025-03-19 23:13:25 +00:00
pycore_runtime_init.h Remove duplicate includes: Include/internal/ (#132624) 2025-05-06 02:08:42 +01:00
pycore_runtime_init_generated.h [3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080) 2025-06-28 19:12:54 +01:00
pycore_runtime_structs.h gh-131238: Add pycore_interpframe_structs.h header (#131553) 2025-03-21 17:19:47 +00:00
pycore_semaphore.h gh-131082: Add missing guards for WIN32_LEAN_AND_MEAN (#131044) 2025-03-11 12:33:01 +01:00
pycore_setobject.h gh-130312: SET_ADD should not lock (#130136) 2025-03-21 15:58:32 -07:00
pycore_signal.h
pycore_sliceobject.h
pycore_stackref.h [3.14] gh-135906: Use _PyObject_CAST in internal headers (GH-135892) (GH-136392) 2025-07-07 17:21:28 +00:00
pycore_stats.h GH-131238: More refactoring of core header files (GH-131351) 2025-03-17 14:41:05 +00:00
pycore_strhex.h
pycore_structs.h GH-131498: Cases generator: manage stacks automatically (GH-132074) 2025-04-04 17:59:36 +01:00
pycore_structseq.h
pycore_symtable.h gh-130924: Do not create cells for usages of names in local annotations (#131843) 2025-03-29 21:15:48 +00:00
pycore_sysmodule.h gh-131591: Implement PEP 768 (#131937) 2025-04-03 16:20:01 +01:00
pycore_template.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_time.h gh-131238: Use pycore_interp_structs.h header (#131481) 2025-03-19 23:13:25 +00:00
pycore_token.h gh-132661: Implement PEP 750 (#132662) 2025-04-30 11:46:41 +02:00
pycore_traceback.h gh-127604: Add C stack dumps to faulthandler (#128159) 2025-04-21 20:48:02 +01:00
pycore_tracemalloc.h gh-129185: Use PyMutex in tracemalloc (#129246) 2025-01-24 11:25:24 +01:00
pycore_tstate.h gh-131586: Avoid refcount contention in some "special" calls (#131588) 2025-03-26 14:38:47 -04:00
pycore_tuple.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
pycore_typedefs.h gh-130931: Add pycore_typedefs.h internal header (#131396) 2025-03-19 15:23:32 +01:00
pycore_typeobject.h Revert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129) 2025-04-28 23:38:29 -07:00
pycore_typevarobject.h
pycore_ucnhash.h
pycore_unicodeobject.h [3.14] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133942) 2025-05-13 16:25:08 +03:00
pycore_unicodeobject_generated.h [3.14] gh-91048: Fix external inspection multi-threaded performance (GH-136005) (#136080) 2025-06-28 19:12:54 +01:00
pycore_unionobject.h gh-105499: Merge typing.Union and types.UnionType (#105511) 2025-03-04 11:44:19 -08:00
pycore_uniqueid.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_uop_ids.h GH-131798: Split CALL_LEN into several uops (GH-133180) 2025-05-05 14:31:48 -07:00
pycore_uop_metadata.h Revert "gh-133395: add option for extension modules to specialize BINARY_OP/SUBSCR, apply to arrays (#133396)" (#133498) 2025-05-06 13:12:26 +03:00
pycore_warnings.h GH-131238: Core header refactor (GH-131250) 2025-03-17 09:19:04 +00:00
pycore_weakref.h [3.14] gh-135607: remove null checking of weakref list in dealloc of extension modules and objects (#135614) (#136119) 2025-06-30 15:59:22 +02:00