Optimize page fault handling by caching last accessed range - #36
jvbronzeado wants to merge 3 commits into
Conversation
|
|
||
| // 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; |
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) { |
There was a problem hiding this comment.
style nit: space between if and (
| @@ -1 +1 @@ | |||
| #include <kernel/mm.h> | |||
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 |
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) |
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
| return true; | ||
| } | ||
|
|
||
| mm_context_t *mm_create_context() { |
There was a problem hiding this comment.
you need to initialize the last_pagefault member to NULL here. slab-allocated data is not zeroed.
No description provided.