Commit graph

11 commits

Author SHA1 Message Date
Slobodan Predolac
c411b0ab3b Collapse arena_inlines_a/b and jemalloc_internal_inlines_b into arena_inlines.h
The arena_inlines_a.h / arena_inlines_b.h split, and the parallel
jemalloc_internal_inlines_b.h file that defined arena_choose() between
them, all existed to manage one ordering constraint: arena_choose()
had to be defined before arena_choose_maybe_huge() (which calls it),
but had to be defined after the tsd/tcache inlines it depends on.
Three files, one staged include order, no real semantic boundary.

After the malloc_dispatch refactor moved the heaviest tcache-pulling
inlines (the malloc/dalloc routing) out of arena_inlines_b.h, the
arena-side inlines that remain all belong together.  Merge them into
a single arena_inlines.h that:

  - explicitly includes jemalloc_internal_inlines_a.h (for tsd
    accessors) and tcache.h (for tcache_arena_associate /
    reassociate externs) -- both were previously pulled
    transitively;
  - orders functions so each caller appears after its callee
    (cheap accessors -> arena_choose family -> the rest), so no
    forward references are needed;
  - drops the load-bearing-split comment, which is no longer true.

All consumers that included any of the three old headers now include
arena_inlines.h.  background_thread_inlines.h now pulls a heavier set
of transitive includes (prof.h, large.h, mutex.h, ...) than when it
only needed cheap accessors; this is acceptable because every TU that
includes background_thread_inlines.h already pulls those headers via
other paths.
2026-05-29 09:04:09 -07:00
Slobodan Predolac
89440d0fd3 Drop umbrella include from 9 medium .c files (batch 2)
Converted: hpa_utils, ecache, extent_mmap, util, safety_check,
prof_stats, peak_event, inspect, log.

(src/div.c was already minimal; skipped.)

One latent hermeticity bug surfaced: peak_event.h declared
`extern te_base_cb_t peak_te_handler;` but didn't include
thread_event_registry.h where te_base_cb_t is typedef'd.  Added the
include to peak_event.h.  peak_event.c also needs thread_event.h
directly for TE_MIN_START_WAIT.

Step 6 (Option B) of the cyclical-dep cleanup, batch 2 of N.
2026-05-29 08:53:58 -07:00
Slobodan Predolac
e0a8401533 Extract arena state and management from jemalloc.c into arenas_management module 2026-04-30 15:17:18 -04:00
guangli-dai
6200e8987f Reformat the codebase with the clang-format 18. 2026-03-10 18:14:33 -07:00
Kevin Svetlitski
da66aa391f Enable a few additional warnings for CI and fix the issues they uncovered
- `-Wmissing-prototypes` and `-Wmissing-variable-declarations` are
  helpful for finding dead code and/or things that should be `static`
  but aren't marked as such.
- `-Wunused-macros` is of similar utility, but for identifying dead macros.
- `-Wunreachable-code` and `-Wunreachable-code-aggressive` do exactly
  what they say: flag unreachable code.
2023-08-11 13:56:23 -07:00
David Goldblatt
3967329813 Arena: share bin offsets in a global.
This saves us a cache miss when lookup up the arena bin offset in a remote
arena during tcache flush.  All arenas share the base offset, and so we don't
need to look it up repeatedly for each arena.  Secondarily, it shaves 288 bytes
off the arena on, e.g., x86-64.
2021-02-04 14:10:43 -08:00
David Goldblatt
294b276fc7 PA: Parameterize emap. Move emap_global to arena.
This lets us test the PA module without interfering with the global emap used by
the real allocator (the one not under test).
2020-04-10 13:12:47 -07:00
David Goldblatt
7e6c8a7286 Emap: Standardize naming.
Namespace everything under emap_, always specify what it is we're looking up
(emap_lookup -> emap_edata_lookup), and use "ctx" over "info".
2020-02-17 10:50:51 -08:00
David Goldblatt
9b5d105fc3 Emap: Move in iealloc.
This is logically scoped to the emap.
2020-02-17 10:50:51 -08:00
David Goldblatt
a7862df616 Rename extent_t to edata_t.
This frees us up from the unfortunate extent/extent2 naming collision.
2019-12-20 10:18:40 -08:00
David Goldblatt
403f2d1664 Extents: Split out introspection functionality.
This isn't really part of the core extent allocation facilities.  Especially as
this module grows, having it in its own place may come in handy.
2019-12-20 10:18:40 -08:00