Skip to content

Conversation

kevyang
Copy link
Contributor

@kevyang kevyang commented Jan 14, 2016

previously, slab was failing one of the unit tests for allocating large items. this is because the slab profile was not being generated ideally; the largest slab profile for slab size of 1 MB was a little over 500 KB, such that the profile entry was too large to fit 2 items but wasted nearly 500 KB of space. this PR addresses this by starting with the max chunk size and moving down when generating a slab profile.

@kevyang kevyang mentioned this pull request Jan 17, 2016
@kevyang
Copy link
Contributor Author

kevyang commented Jan 22, 2016

ping, want to get this merged to start canarying

return CC_ERROR;
}

nbyte = SLAB_ALIGN_DOWN(max_chunk_size, CC_ALIGNMENT);

This comment was marked as spam.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the problem with the unit test failing results from starting at the min. This is because if we start at the min and grow upwards, we cannot guarantee the largest size will fit "snugly" given the slab size; in the original implementation the largest item size was just over 500 KB with just one item per slab despite the slab size being 1 MB

@kevyang
Copy link
Contributor Author

kevyang commented Feb 3, 2016

As discussed with @thinkingfish in the meeting on Monday, we are moving to a hybrid linear/exponential growth scheme to give us the best of both worlds between adhering to min_chunk_size, max_chunk_size, and minimizing internal fragmentation. See the comments in the code for an explanation of the scheme. I've tested this manually by changing min/max chunk size and growth factor and it seems to work. it also passes all of the unit tests we have written for slab.

@@ -266,10 +323,25 @@ _slab_profile_setup(char *setup_profile, char *setup_profile_factor)

profile[i++] = nbyte;
nitem = slab_capacity() / nbyte / growth_factor;
if (nitem > 0) {
if (nitem > linear_nitem) {

This comment was marked as spam.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right. had a brain fart while restructuring my loops. thanks!

@thinkingfish

This comment was marked as spam.

kevyang added a commit that referenced this pull request Feb 4, 2016
@kevyang kevyang merged commit d3add60 into twitter:master Feb 4, 2016
michalbiesek added a commit to michalbiesek/pelikan that referenced this pull request Sep 5, 2019
…-pmem-mapping-addresses

Changing mapping addresses for pmem datapools
swlynch99 pushed a commit to swlynch99/pelikan-twitter that referenced this pull request Sep 30, 2019
add metric_print - will be used in stats implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants