Skip to content
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

Use dirty page flags instead of dirty regions #219

Merged
merged 12 commits into from
Feb 7, 2022
Merged

Conversation

Shillaker
Copy link
Collaborator

@Shillaker Shillaker commented Feb 2, 2022

Previously we were taking the list of dirty pages, converting this into a std::vector<std::pair<uint32_t, uint32_t>> to express a set of regions, then passing this set of regions through the code to the snapshot diffing logic. In fact, it's more efficient and simpler to skip this computation and just directly pass around the list of dirty page flags as a std::vector<char>. This PR reworks the necessary logic and testing around this change.

I've also added a couple of other small changes along the way:

  • Move from using a std::map<uint32_t, SnapshotMergeRegion> to a std::vector<SnapshotMergeRegion> on each snapshot. This improves insertion performance, and we can sort the vector when necessary (note that sorting was the point of having the map in the first place).
  • Add none dirty tracking, which just marks all pages as dirty. This may be optimal for workloads with a small memory where most of that memory will be dirty anyway, so diffing every page outweighs the cost of the dirty tracking.
  • Fix a race condition in Executor::executeThreads.
  • Switch off catch2 signal handling to avoid needing to reinitialise the segfault dirty tracker in tests.
  • Remove use of "note" and the like at the start of comments. The fact that it's a comment implies that the reader should take note. I regret doing this, it started with a couple of files then spiralled into doing a whole find and replace. Should have put it in another PR.

@Shillaker Shillaker changed the title Simplify dirty page tracking Use dirty page flags instead of dirty regions Feb 3, 2022
@Shillaker Shillaker marked this pull request as ready for review February 3, 2022 12:45
@@ -19,6 +19,9 @@
#include <faabric/util/string_tools.h>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changes in this file are a mix of fixing the race condition and updating to the pages vs. regions change. Race condition seemed to manifest in distributed tests on this PR, so fixed it.

}

if (!exists) {
std::string snapshotKey = faabric::util::getMainThreadSnapshotKey(msg);
bool alreadyExists = reg.snapshotExists(snapshotKey);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybre refactor to snapshotAlreadyExists?

include/faabric/util/dirty.h Show resolved Hide resolved
src/scheduler/Executor.cpp Outdated Show resolved Hide resolved
@Shillaker Shillaker self-assigned this Feb 7, 2022
@Shillaker Shillaker merged commit 51f6a25 into master Feb 7, 2022
@Shillaker Shillaker deleted the simplify-dirty branch February 7, 2022 10:11
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.

None yet

2 participants