Skip to content

Commit

Permalink
src: inspect kernel transparent_hugepage flag values without assuming…
Browse files Browse the repository at this point in the history
… their length or ordering
  • Loading branch information
jayaddison committed Jan 26, 2021
1 parent 5a07333 commit 72082b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,16 @@ bool IsTransparentHugePagesEnabled() {
return false;
}

std::string always, madvise;
bool enabled;
if (ifs.is_open()) {
ifs >> always >> madvise;
std::string token;
while (ifs >> token) {
enabled = enabled || token == "[always]" || token == "[madvise]";
}
}
ifs.close();

return always == "[always]" || madvise == "[madvise]";
return enabled;
}
#elif defined(__FreeBSD__)
bool IsSuperPagesEnabled() {
Expand Down

0 comments on commit 72082b9

Please sign in to comment.