David Goldblatt
0a2fcfac01
Tcache: Hold cache bin allocation explicitly.
2020-03-12 11:54:19 -07:00
David Goldblatt
d498a4bb08
Cache bin: Add an emptiness assertion.
2020-03-12 11:54:19 -07:00
David Goldblatt
6a7aa46ef7
Cache bin: Add a debug method for init checking.
2020-03-12 11:54:19 -07:00
David Goldblatt
370c1ea007
Cache bin: Write the unit test in terms of the API
...
I.e. stop allowing the unit test to have secret access to implementation
internals.
2020-03-12 11:54:19 -07:00
David Goldblatt
7f5ebd211c
Cache bin: set low-water internally.
2020-03-12 11:54:19 -07:00
David Goldblatt
60113dfe3b
Cache bin: Move in initialization code.
2020-03-12 11:54:19 -07:00
David Goldblatt
44529da852
Cache-bin: Make flush modifications internal
...
I.e. the tcache code just calls a cache-bin function to finish flush (and move
pointers around, etc.). It doesn't directly access the cache-bin's owned memory
any more.
2020-03-12 11:54:19 -07:00
David Goldblatt
ff6acc6ed5
Cache bin: simplify names and argument ordering.
...
We always start with the cache bin, then its info (if necessary).
2020-03-12 11:54:19 -07:00
David Goldblatt
e1dcc557d6
Cache bin: Only take the relevant cache_bin_info_t
...
Previously, we took an array of cache_bin_info_ts and an index, and dereferenced
ourselves. But infos for other cache_bins aren't relevant to any particular
cache bin, so that should be the caller's job.
2020-03-12 11:54:19 -07:00
David Goldblatt
1b00d808d7
cache_bin: Don't let arena see empty position.
2020-03-12 11:54:19 -07:00
David Goldblatt
d303f30796
cache_bin nflush -> n.
...
We're going to use it on the fill pathway as well.
2020-03-12 11:54:19 -07:00
David Goldblatt
74d36d78ef
Cache bin: Make ncached_max a query on the info_t.
2020-03-12 11:54:19 -07:00
David Goldblatt
b66c0973cc
cache_bin: Don't allow direct internals access.
2020-03-12 11:54:19 -07:00
David Goldblatt
da68f73296
Move percpu_arena_update.
...
It's not really part of the API of the arena; it changes which arena we're using
that API on.
2020-03-12 11:54:19 -07:00
David Goldblatt
909c501b07
Cache_bin: Shouldn't know about tcache.
...
Instead, have it take the cache_bin_info_ts to use by pointer. While we're
here, add a src file for the cache bin.
2020-03-12 11:54:19 -07:00
David Goldblatt
79f1ee2fc0
Move junking out of arena/tcache code.
...
This is debug only and we keep it off the fast path. Moving it here simplifies
the internal logic.
This never tries to junk on regions that were shrunk via xallocx. I think this
is fine for two reasons:
- The shrunk-with-xallocx case is rare.
- We don't always do that anyway before this diff (it depends on the opt
settings and extent hooks in effect).
2020-03-12 11:54:19 -07:00
David T. Goldblatt
6c3491ad31
Tcache: Unify bin flush logic.
...
The small and large pathways share most of their logic, even if some of the
individual operations are different. We pull out the common logic into a
force-inlined function, and then specialize twice, once for each value of
"small".
2020-02-25 10:21:03 -08:00
David T. Goldblatt
9f4fc27389
Ehooks: Fix a build warning.
...
We wrote `return some_void_func()` in a function returning void, which is
confusing and triggers warnings on MSVC.
2020-02-25 10:21:03 -08:00
David T. Goldblatt
162c2bcf31
Background thread: take base as a parameter.
2020-02-18 11:22:09 -08:00
David T. Goldblatt
29436fa056
Break prof and tcache knowledge of b0.
2020-02-18 11:22:09 -08:00
David T. Goldblatt
a0c1f4ac57
Rtree: take the base allocator as a parameter.
...
This facilitates better testing by avoiding mixing of the "real" base with the
base used by the rtree under test.
2020-02-18 11:22:09 -08:00
David T. Goldblatt
7013716aaa
Emap: Take (and propagate) a zeroed parameter.
...
Rtree needs this, and we should really treat them similarly.
2020-02-18 11:22:09 -08:00
David T. Goldblatt
182192f83c
Base: Pull into a single header.
2020-02-18 11:22:09 -08:00
David T. Goldblatt
34b7165fde
Put szind_t, pszind_t in sz.h.
2020-02-18 11:22:09 -08: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
ac50c1e44b
Emap: Remove direct access to emap internals.
...
In the process, we do a few local cleanups and optimizations. In particular,
the size safety check on tcache flush no longer does a redundant load.
2020-02-17 10:50:51 -08:00
David Goldblatt
06e42090f7
Make jemalloc.c use the emap interface.
...
While we're here, we'll also clean up some style nits.
2020-02-17 10:50:51 -08:00
David Goldblatt
f7d9c6c42d
Emap: Move in alloc_ctx lookup functionality.
2020-02-17 10:50:51 -08:00
David Goldblatt
65a54d7714
Emap: Move in szind and slab modifications.
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
1d449bd9a6
Emap: Internal rtree context setting.
...
The only time sharing an rtree context saves across extent operations isn't a
no-op is when tsd is unavailable. But this happens only in situations like
thread death or initialization, and we don't care about shaving off every
possible cycle in such scenarios.
2020-02-17 10:50:51 -08:00
David Goldblatt
08eb1e6c31
Emap: Comments and cleanup
...
Document some of the public interface, and hide the functions that are no longer
used outside of the emap module.
2020-02-17 10:50:51 -08:00
David Goldblatt
231d1477e5
Rename emap_split_prepare_t -> emap_prepare_t.
...
Both the split and merge functions use it.
2020-02-17 10:50:51 -08:00
David Goldblatt
0586a56f39
Emap: Move in merge functionality.
2020-02-17 10:50:51 -08:00
David Goldblatt
040eac77cc
Tell edatas their creation arena immediately.
...
This avoids having to pass it in anywhere else.
2020-02-17 10:50:51 -08:00
David Goldblatt
7c7b702064
Emap: Move over metadata splitting logic.
2020-02-17 10:50:51 -08:00
David Goldblatt
44f5f53605
Emap: Move over deregistration functions.
2020-02-17 10:50:51 -08:00
David Goldblatt
6513d9d923
Emap: Move over deregistration boundary functions.
2020-02-17 10:50:51 -08:00
David Goldblatt
9b5ca0b09d
Emap: Move in slab interior registration.
2020-02-17 10:50:51 -08:00
David Goldblatt
d05b61db4a
Emap: Move extent boundary registration in.
2020-02-17 10:50:51 -08:00
David Goldblatt
ca21ce4071
Emap: Move in write_acquired from extent.
2020-02-17 10:50:51 -08:00
David Goldblatt
01f255161c
Add emap, for tracking extent locking.
2020-02-17 10:50:51 -08:00
Qi Wang
ba0e35411c
Rework the bin locking around tcache refill / flush.
...
Previously, tcache fill/flush (as well as small alloc/dalloc on the arena) may
potentially drop the bin lock for slab_alloc and slab_dalloc. This commit
refactors the logic so that the slab calls happen in the same function / level
as the bin lock / unlock. The main purpose is to be able to use flat combining
without having to keep track of stack state.
In the meantime, this change reduces the locking, especially for slab_dalloc
calls, where nothing happens after the call.
2020-02-13 23:31:54 -08:00
Kamil Rytarowski
7fd22f7b2e
Fix Undefined Behavior in hash.h
...
hash.h:200:27, left shift of 250 by 24 places cannot be represented in type 'int'
2020-02-13 12:25:26 -08:00
Yinan Zhang
9cac3fa8f5
Encapsulate buffer allocation in buffered writer
2020-02-04 13:21:58 -08:00
Yinan Zhang
bdc08b5158
Better naming buffered writer
2020-02-04 13:21:58 -08:00
Qi Wang
c6bfe55857
Update the tsd description.
2020-02-04 13:07:05 -08:00
Qi Wang
e896522616
Abbreviate thread-event to te.
2020-02-04 13:07:05 -08:00
Qi Wang
5e500523a0
Remove thread_event_boot().
2020-02-04 00:18:15 -08:00
Qi Wang
97dd79db6c
Implement deallocation events.
...
Make the event module to accept two event types, and pass around the event
context. Use bytes-based events to trigger tcache GC on deallocation, and get
rid of the tcache ticker.
2020-02-04 00:18:15 -08:00