8257076: os::scan_pages is empty on all platforms

Reviewed-by: dholmes, stuefe
This commit is contained in:
Sonia Zaldana Calles 2023-11-22 16:01:27 +00:00 committed by Thomas Stuefe
parent 25cebe8c3e
commit 35526d02c3
7 changed files with 1 additions and 83 deletions

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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,

View File

@ -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.
@ -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);
}

View File

@ -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);
}
@ -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;
@ -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------|

View File

@ -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,