Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
src: reduce large pages code duplication
Declaring and initializing a `struct text_region` is common to all
three implementations of the large pages mapping code. Let's make it
unconditional.

PR-URL: #31385
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: JungMinu - Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gus Caplan <me@gus.host>
  • Loading branch information
Gabriel Schulhof committed Mar 6, 2020
commit 269351021e9759d2065e5134fb54be7250b33584
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 @@ -108,16 +108,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 @@ -169,9 +168,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 @@ -228,8 +224,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