-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NFC: sizeclass: differentiate minimum step size and minimum allocation sizes #651
NFC: sizeclass: differentiate minimum step size and minimum allocation sizes #651
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I wonder if we should make STEP or SIZE configurable from CMake, so we can experiment with configurations.
It would be interesting to reduce step to 8, which would get us 16, 24, 32, 40, 48, 56, 64, 80, ...
Like that? |
Is there a static_assert that the main is at least two pointers? |
Yes, two, sort of. Once directly by the configuration: And once by the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Out of curiosity, I did a little parameter sweeping with It could be more interesting to do an analogous sweep on CHERI, where |
Looks pretty noisy, but I can run some experiments on Monday |
@nwf-msr would it make sense to add something like: if (SNMALLOC_BENCHMARK_INDIVIDUAL_CONFIGS)
foreach (STEP 8 16 32)
foreach (MIN 16 32 64)
if ((${STEP} EQUAL 8) AND (${MIN} EQUAL 64))
continue()
endif()
set(DEFINES "-DSNMALLOC_MIN_ALLOC_STEP_SIZE=${STEP}" "-DSNMALLOC_MIN_ALLOC_SIZE=${MIN}")
set(NAME "step-${STEP}-min-${MIN}")
add_shim(snmallocshim-${NAME} SHARED ${SHIM_FILES})
target_compile_definitions(snmallocshim-${NAME} PRIVATE ${DEFINES})
if (SNMALLOC_BUILD_TESTING)
make_tests(${NAME} ${DEFINES})
endif()
endforeach()
endforeach()
endif() # SNMALLOC_BENCHMARK_INDIVIDUAL_CONFIGS So that we can rebuild the libraries for the test? |
The sizeclass was already testing most of this, so just add the missing bits. Forgo some tests whose failure would have implied earlier failures. This moves the last dynamic call of size_to_sizeclass_const into tests (and so, too, to_exp_mant_const). sizeclasstable.h still contains a static call to compute NUM_SMALL_SIZECLASSES from MAX_SMALL_SIZECLASS_SIZE.
Only its _const sibling is used, and little at that, now that almost everything to do with sizes and size classes is table-driven.
This just means I don't need to remember to set a breakpoint on exit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Add support for a minimum allocation size that isn't the minimum step of the sizeclass table.
Taking those two suggestions; thanks! Will merge as soon as CI's happy. |
No functional change intended yet. Just going through the exercise of separating
MIN_ALLOC_SIZE
's two hats, but leaving the two at the same value.So why?
We think this might be useful, letting us use less space in #637 (by leaving
MIN_ALLOC_STEP_SIZE
at16
but raisingMIN_ALLOC_SIZE
to32
, meaning that sizeclasses 0 and 1 would not be allocable), but it might be more generally useful. It's also probably easier to review without all the rest of that mess at the same time. Speaking of review, as per usual, this might be best read in commit order rather than all at once, and the punchline is in the last commit.