Skip to content

Commit

Permalink
8257076: os::scan_pages is empty on all platforms
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, stuefe
  • Loading branch information
Sonia Zaldana Calles authored and tstuefe committed Nov 22, 2023
1 parent 25cebe8 commit 35526d0
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 83 deletions.
4 changes: 0 additions & 4 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1914,10 +1914,6 @@ bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, siz
return false;
}

char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
return end;
}

// Reserves and attaches a shared memory segment.
char* os::pd_reserve_memory(size_t bytes, bool exec) {
// Always round to os::vm_page_size(), which may be larger than 4K.
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,11 +1674,6 @@ bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, siz
return false;
}

char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found) {
return end;
}


bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) {
#if defined(__OpenBSD__)
// XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD
Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3012,12 +3012,6 @@ size_t os::numa_get_leaf_groups(uint *ids, size_t size) {
return i;
}

char *os::scan_pages(char *start, char* end, page_info* page_expected,
page_info* page_found) {
return end;
}


int os::Linux::sched_getcpu_syscall(void) {
unsigned int cpu = 0;
long retval = -1;
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3825,11 +3825,6 @@ bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, siz
return false;
}

char *os::scan_pages(char *start, char* end, page_info* page_expected,
page_info* page_found) {
return end;
}

char* os::non_memory_address_word() {
// Must never look like an address returned by reserve_memory,
// even in its subfields (as defined by the CPU immediate fields,
Expand Down
54 changes: 0 additions & 54 deletions src/hotspot/share/gc/parallel/mutableNUMASpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,6 @@ void MutableNUMASpace::update() {
SpaceDecorator::Clear,
SpaceDecorator::DontMangle);
}

scan_pages(NUMAPageScanRate);
}

// Scan pages. Free pages that have smaller size or wrong placement.
void MutableNUMASpace::scan_pages(size_t page_count)
{
size_t pages_per_chunk = page_count / lgrp_spaces()->length();
if (pages_per_chunk > 0) {
for (int i = 0; i < lgrp_spaces()->length(); i++) {
LGRPSpace *ls = lgrp_spaces()->at(i);
ls->scan_pages(page_size(), pages_per_chunk);
}
}
}

// Accumulate statistics about the allocation rate of each lgrp.
Expand Down Expand Up @@ -691,43 +677,3 @@ void MutableNUMASpace::LGRPSpace::accumulate_statistics(size_t page_size) {
pointer_delta(space()->end(), end, sizeof(char));

}

// Scan page_count pages and verify if they have the right size and right placement.
// If invalid pages are found they are freed in hope that subsequent reallocation
// will be more successful.
void MutableNUMASpace::LGRPSpace::scan_pages(size_t page_size, size_t page_count)
{
char* range_start = (char*)align_up(space()->bottom(), page_size);
char* range_end = (char*)align_down(space()->end(), page_size);

if (range_start > last_page_scanned() || last_page_scanned() >= range_end) {
set_last_page_scanned(range_start);
}

char *scan_start = last_page_scanned();
char* scan_end = MIN2(scan_start + page_size * page_count, range_end);

os::page_info page_expected, page_found;
page_expected.size = page_size;
page_expected.lgrp_id = checked_cast<uint>(lgrp_id());

char *s = scan_start;
while (s < scan_end) {
char *e = os::scan_pages(s, (char*)scan_end, &page_expected, &page_found);
if (e == nullptr) {
break;
}
if (e != scan_end) {
assert(e < scan_end, "e: " PTR_FORMAT " scan_end: " PTR_FORMAT, p2i(e), p2i(scan_end));

if ((page_expected.size != page_size || checked_cast<uint>(page_expected.lgrp_id) != lgrp_id())
&& page_expected.size != 0) {
os::free_memory(s, pointer_delta(e, s, sizeof(char)), page_size);
}
page_expected = page_found;
}
s = e;
}

set_last_page_scanned(scan_end);
}
8 changes: 1 addition & 7 deletions src/hotspot/share/gc/parallel/mutableNUMASpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ class MutableNUMASpace : public MutableSpace {

SpaceStats _space_stats;

char* _last_page_scanned;
char* last_page_scanned() { return _last_page_scanned; }
void set_last_page_scanned(char* p) { _last_page_scanned = p; }
public:
LGRPSpace(uint l, size_t alignment) : _lgrp_id(l), _allocation_failed(false), _last_page_scanned(nullptr) {
LGRPSpace(uint l, size_t alignment) : _lgrp_id(l), _allocation_failed(false) {
_space = new MutableSpace(alignment);
_alloc_rate = new AdaptiveWeightedAverage(NUMAChunkResizeWeight);
}
Expand Down Expand Up @@ -125,7 +122,6 @@ class MutableNUMASpace : public MutableSpace {
void clear_space_stats() { _space_stats = SpaceStats(); }

void accumulate_statistics(size_t page_size);
void scan_pages(size_t page_size, size_t page_count);
};

GrowableArray<LGRPSpace*>* _lgrp_spaces;
Expand Down Expand Up @@ -156,8 +152,6 @@ class MutableNUMASpace : public MutableSpace {
size_t default_chunk_size();
// Adapt the chunk size to follow the allocation rate.
size_t adaptive_chunk_size(int i, size_t limit);
// Scan and free invalid pages.
void scan_pages(size_t page_count);
// Return the bottom_region and the top_region. Align them to page_size() boundary.
// |------------------new_region---------------------------------|
// |----bottom_region--|---intersection---|------top_region------|
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/runtime/os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,6 @@ class os: AllStatic {
size_t size;
int lgrp_id;
};
static char* scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found);

static char* non_memory_address_word();
// reserve, commit and pin the entire memory region
static char* reserve_memory_special(size_t size, size_t alignment, size_t page_size,
Expand Down

1 comment on commit 35526d0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.