Repository navigation
Lookup extent once per time during tcache_flush_small / _large. - #729
Merged
Merged
Conversation
interwq
force-pushed
the
tcache_flush
branch
2 times, most recently
from
March 28, 2017 00:28
5b862c8 to
20ca4db
Compare
interwq
commented
Mar 28, 2017
| assert(arena != NULL); | ||
| for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { | ||
| unsigned nflush = tbin->ncached - rem; | ||
| extent_t *item_extent[nflush]; |
Contributor
Author
There was a problem hiding this comment.
MSVC still doesn't like variable-length arrays. Will fix.
Member
There was a problem hiding this comment.
The approach you took to resolve this looks fine, but for future reference note that the VARIABLE_ARRAY() macro is an alternative.
Contributor
Author
There was a problem hiding this comment.
Ah I was looking for it and couldn't find it. Thanks for the pointer!
jasone
approved these changes
Mar 28, 2017
| * handled in a future pass. | ||
| */ | ||
| *(tbin->avail - 1 - ndeferred) = ptr; | ||
| item_extent[ndeferred] = item_extent[i]; |
Member
There was a problem hiding this comment.
Write the right-hand side as just extent (here and in tcache_bin_flush_large())?
| extent_t *item_extent[TCACHE_NSLOTS_SMALL_MAX]; | ||
| /* Look up extent once per item. */ | ||
| for (unsigned i = 0 ; i < nflush; i++) { | ||
| item_extent[i] = iealloc(tsd_tsdn(tsd), *(tbin->avail - i - 1)); |
Member
There was a problem hiding this comment.
Nit: for consistency, write *(tbin->avail - 1 - i) here (and in tcache_bin_flush_large()) for consistency with the other sites that do similar math.
Contributor
Author
|
Will address feedback and update again before pushing. |
Caching the extents on stack to avoid redundant looking up overhead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caching the extents on stack to avoid redundant looking up overhead.
This resolves #598.