-
Notifications
You must be signed in to change notification settings - Fork 116
Remove ChunkAllocator #491
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
Conversation
2dde429
to
0f38f82
Compare
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.
Some minor nits; generally looks good.
Do you want to add a static_assert
s in backend.h
that GlobalRange
is ConcurrencySafe
?
src/mem/corealloc.h
Outdated
@@ -282,7 +281,7 @@ namespace snmalloc | |||
bumpptr = slab_end; | |||
} | |||
|
|||
ChunkRecord* clear_slab(Metaslab* meta, smallsizeclass_t sizeclass) | |||
Metaslab* clear_slab(Metaslab* meta, smallsizeclass_t sizeclass) |
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.
The return here was always just a type pun and can probably be done away with now.
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.
Good point. I had removed the use-site, but not the return.
} | ||
return tid; | ||
} | ||
|
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.
Generally approve of the idea, but should this actually be in the PAL so we can actually get the platform notion of a thread ID (when it's sufficiently inexpensive to do so)?
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.
Mostly, I just needed some logging that I could uninterleave ;-) Happy for something better to be done. I can drop this commit from the PR, and someone can do something better, or I can leave this, and then someone can improve if they have bandwidth?
My preference is for the later, but what do you think.
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.
This is a strict improvement, so no reason to drop it. Was mostly asking in case there was reason not to do the PAL thing.
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.
I was trying to trace a bug in DecayRange
which only exhibited with concurrency, and this was the quickest thing I could do to get a trace I could understand. I think we can engineer something better.
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.
I think we can engineer something better.
But not tonight ;-)
@@ -24,6 +24,8 @@ namespace snmalloc | |||
|
|||
static constexpr bool Aligned = pal_supports<AlignedAllocation, PAL>; | |||
|
|||
static constexpr bool ConcurrencySafe = true; |
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.
While true at the moment, do we want to promise that all PALs have concurrency-safe (de)alloc routines?
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.
Good question. I could say false instead? Or we could add a feature flag to each Pal that says if it is true?
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.
The Pals have always been assumed to be concurrency safe so far.
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'll leave it to you to squash into one or many commits.
Automatically prepend messages with a thread id. Makes debugging easier.
Now we have an allocation free formatting routine, remove std::cout from tracing.
Ranges can be safe to call from multiple threads. This adds a constexpr field to signify if that is the case.
This is the first commits for adding the DecayRange. It involves