-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add dynamic check for pagemap support #30
Conversation
… is pagemap supported)
On WSL2:
start/stop/start now works. |
// Bit 62 page swapped | ||
// Bit 63 page present | ||
// | ||
// Here we are just checking bit #55 (the soft-dirty bit). |
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 only need this comment once.
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.
Thanks, removed duplicate comment.
fs::resize_file(path, pagesz); | ||
bip::file_mapping mapping = bip::file_mapping(path.generic_string().c_str(), bip::read_write); | ||
bip::mapped_region region = bip::mapped_region(mapping, bip::read_write); | ||
char* p = (char *)region.get_address(); |
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 doubt you need to go through the trouble of creating a temporary file; you can probably just use a variable on the stack.
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.
You are right, that was way overkill, I simplified it.
This is to better support systems like Ubuntu running under WSL2, where the kernel may be running without configured pagemap soft-dirty support, as shown by:
In this change, after attempting the clear the soft-dirty bits when opening a new chainbase db, we try mapping and modifying a 4K page to verify that the soft-dirty feature is working correctly.
@heifner could you try this branch on your system? I have some problems with my own WSL2/windows environment.