Skip to content

Commit

Permalink
src: large pages fix FreeBSD fix region size
Browse files Browse the repository at this point in the history
Makes the size aligned to huge page size by
calculating it from the aligned lower and upper
boundary of the executable address.

PR-URL: #28735
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
devnexen authored and targos committed Aug 2, 2019
1 parent 25aa222 commit 3d51d30
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ static struct text_region FindNodeTextRegion() {
(entry->kve_protection & KVME_PROT_EXEC));

if (!strcmp(exename.c_str(), entry->kve_path) && excmapping) {
size_t size = entry->kve_end - entry->kve_start;
char* estart =
reinterpret_cast<char*>(hugepage_align_up(entry->kve_start));
char* eend =
reinterpret_cast<char*>(hugepage_align_down(entry->kve_end));
size_t size = eend - estart;
nregion.found_text_region = true;
nregion.from =
reinterpret_cast<char*>(hugepage_align_up(entry->kve_start));
nregion.to =
reinterpret_cast<char*>(hugepage_align_down(entry->kve_end));
nregion.from = estart;
nregion.to = eend;
nregion.total_hugepages = size / hps;
break;
}
Expand Down

0 comments on commit 3d51d30

Please sign in to comment.