Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: reduce large pages code duplication #31385

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/large_pages/node_large_page.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,15 @@ inline uintptr_t hugepage_align_down(uintptr_t addr) {
// This is also handling the case where the first line is not the binary.

static struct text_region FindNodeTextRegion() {
struct text_region nregion;
nregion.found_text_region = false;
#if defined(__linux__)
std::ifstream ifs;
std::string map_line;
std::string permission;
std::string dev;
char dash;
uintptr_t start, end, offset, inode;
struct text_region nregion;

nregion.found_text_region = false;

ifs.open("/proc/self/maps");
if (!ifs) {
Expand Down Expand Up @@ -161,9 +160,6 @@ static struct text_region FindNodeTextRegion() {

ifs.close();
#elif defined(__FreeBSD__)
struct text_region nregion;
nregion.found_text_region = false;

std::string exename;
{
char selfexe[PATH_MAX];
Expand Down Expand Up @@ -220,8 +216,6 @@ static struct text_region FindNodeTextRegion() {
start += cursz;
}
#elif defined(__APPLE__)
struct text_region nregion;
nregion.found_text_region = false;
struct vm_region_submap_info_64 map;
mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64;
vm_address_t addr = 0UL;
Expand Down