Skip to content

Remove ChunkAllocator - #491

Merged
Matthew Parkinson (mjp41) merged 5 commits into
microsoft:mainfrom
mjp41:predecayrange
Mar 24, 2022
Merged

Remove ChunkAllocator#491
Matthew Parkinson (mjp41) merged 5 commits into
microsoft:mainfrom
mjp41:predecayrange

Conversation

@mjp41

Copy link
Copy Markdown
Member

This is the first commits for adding the DecayRange. It involves

  • removing the redundant ChunkAllocator
  • Adding a field representing if a Range is concurrency safe
  • Fixing OE Stats
  • Improving the message printing.

Copy link
Copy Markdown
Contributor

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_asserts in backend.h that GlobalRange is ConcurrencySafe?

Comment thread src/mem/corealloc.h Outdated
}

ChunkRecord* clear_slab(Metaslab* meta, smallsizeclass_t sizeclass)
Metaslab* clear_slab(Metaslab* meta, smallsizeclass_t sizeclass)

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

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.

Comment thread src/pal/pal.h
}
return tid;
}

Copy link
Copy Markdown
Contributor

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)?

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member Author

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 ;-)

Comment thread src/backend/palrange.h

static constexpr bool Aligned = pal_supports<AlignedAllocation, PAL>;

static constexpr bool ConcurrencySafe = true;

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Member Author

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?

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Contributor

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.
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