Use mlock2() instead of mlock() on Linux and use mlockall(MCL_FUTURE).#98
Open
ghuls wants to merge 1 commit intohoytech:masterfrom
Open
Use mlock2() instead of mlock() on Linux and use mlockall(MCL_FUTURE).#98ghuls wants to merge 1 commit intohoytech:masterfrom
ghuls wants to merge 1 commit intohoytech:masterfrom
Conversation
agowa
reviewed
Mar 2, 2024
vmtouch.c
Outdated
| printf(" -t touch pages into memory\n"); | ||
| printf(" -e evict pages from memory\n"); | ||
| printf(" -l lock pages in physical memory with mlock(2)\n"); | ||
| printf(" -l lock pages in physical memory with mlock(2) or mlock2(2)\n"); |
There was a problem hiding this comment.
How about using ifndef her too? that way the usage help would clearly show which one it is using.
Use mlock2() instead of mlock() on Linux:
- mlock2() allows a third argument MLOCK_ONFAULT, which allow to
lock the pages in a range before touching them, so mlock2()
can be called before touching all pages instead of after.
- "vmtouch -t -l" some_file would not keep the pages in cache
after touching them, so at the lock() step they needed to
be read again from disk. After this patch files are cached
twice as fast on this system.
Use mlockall(MCL_FUTURE) instead of mlockall(MCL_CURRENT):
- Set mlockall(MCL_FUTURE) before touching pages to have similar
behaviour as the mlock2() approach above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use mlock2() instead of mlock() on Linux:
lock the pages in a range before touching them, so mlock2()
can be called before touching all pages instead of after.
after touching them, so at the lock() step they needed to
be read again from disk. After this patch files are cached
twice as fast on this system.
Use mlockall(MCL_FUTURE) instead of mlockall(MCL_CURRENT):
behaviour as the mlock2() approach above.