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: nodejs#28735
Reviewed-By: Rod Vagg <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
devnexen authored and Trott committed Jul 30, 2019
1 parent 4a1502b commit de88d6c
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 de88d6c

Please sign in to comment.