Optimize page fault handling by caching last accessed range#36
Open
jvbronzeado wants to merge 3 commits into
Open
Optimize page fault handling by caching last accessed range#36jvbronzeado wants to merge 3 commits into
jvbronzeado wants to merge 3 commits into
Conversation
Mathewnd
requested changes
Jul 10, 2026
|
|
||
| // we look at the last page fault range and check if the address is in this range | ||
| // this avoids more expensive tree lookup | ||
| mm_range_t* range = space->last_pagefault; |
Owner
There was a problem hiding this comment.
style nit: * goes in the right side
| // we look at the last page fault range and check if the address is in this range | ||
| // this avoids more expensive tree lookup | ||
| mm_range_t* range = space->last_pagefault; | ||
| if(range == NULL || range->start > addr || addr >= range->start + range->size) { |
Owner
There was a problem hiding this comment.
style nit: space between if and (
| @@ -1 +1 @@ | |||
| #include <kernel/mm.h> | |||
Owner
There was a problem hiding this comment.
This is missing handling for some cases like mm_insert_range coalescing. Make sure to check all places where mm_free_range() is called.
| mm_range_t *range = mm_get_range(space, addr); | ||
|
|
||
| // we look at the last page fault range and check if the address is in this range | ||
| // this avoids more expensive tree lookup |
Owner
There was a problem hiding this comment.
nit: "this might avoid a more expensive tree lookup"
|
|
||
| if (free) { | ||
| // release page data | ||
| if (space->last_pagefault == range) |
Owner
There was a problem hiding this comment.
This check is only really needed in the complete unmapping case:
if (free) {
// <----- insert it here
rbtree_remove(&space->ranges, &range->rbtree_node);
mm_destroy_range(range, 0, range->size, 0);
mm_free_range(range);
}
in the other cases, the range is not really free'd and so it just checks against the range's new base address/size
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.
No description provided.