7124829: NUMA: memory leak on Linux with large pages
In os::free_memory() use mmap with the same attributes as for the heap space Reviewed-by: kvn
This commit is contained in:
parent
3c164a7525
commit
c7ec06ba8e
@ -2835,7 +2835,7 @@ void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void os::free_memory(char *addr, size_t bytes) {
|
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
|
||||||
::madvise(addr, bytes, MADV_DONTNEED);
|
::madvise(addr, bytes, MADV_DONTNEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2546,8 +2546,8 @@ void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void os::free_memory(char *addr, size_t bytes) {
|
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
|
||||||
commit_memory(addr, bytes, false);
|
commit_memory(addr, bytes, alignment_hint, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void os::numa_make_global(char *addr, size_t bytes) {
|
void os::numa_make_global(char *addr, size_t bytes) {
|
||||||
|
@ -2821,7 +2821,7 @@ bool os::commit_memory(char* addr, size_t bytes, size_t alignment_hint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Uncommit the pages in a specified region.
|
// Uncommit the pages in a specified region.
|
||||||
void os::free_memory(char* addr, size_t bytes) {
|
void os::free_memory(char* addr, size_t bytes, size_t alignment_hint) {
|
||||||
if (madvise(addr, bytes, MADV_FREE) < 0) {
|
if (madvise(addr, bytes, MADV_FREE) < 0) {
|
||||||
debug_only(warning("MADV_FREE failed."));
|
debug_only(warning("MADV_FREE failed."));
|
||||||
return;
|
return;
|
||||||
|
@ -3130,7 +3130,7 @@ bool os::unguard_memory(char* addr, size_t bytes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { }
|
void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { }
|
||||||
void os::free_memory(char *addr, size_t bytes) { }
|
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) { }
|
||||||
void os::numa_make_global(char *addr, size_t bytes) { }
|
void os::numa_make_global(char *addr, size_t bytes) { }
|
||||||
void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { }
|
void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { }
|
||||||
bool os::numa_topology_changed() { return false; }
|
bool os::numa_topology_changed() { return false; }
|
||||||
|
@ -282,7 +282,7 @@ void MutableNUMASpace::bias_region(MemRegion mr, int lgrp_id) {
|
|||||||
// large page can be broken down if we require small pages.
|
// large page can be broken down if we require small pages.
|
||||||
os::realign_memory((char*)aligned_region.start(), aligned_region.byte_size(), page_size());
|
os::realign_memory((char*)aligned_region.start(), aligned_region.byte_size(), page_size());
|
||||||
// Then we uncommit the pages in the range.
|
// Then we uncommit the pages in the range.
|
||||||
os::free_memory((char*)aligned_region.start(), aligned_region.byte_size());
|
os::free_memory((char*)aligned_region.start(), aligned_region.byte_size(), page_size());
|
||||||
// And make them local/first-touch biased.
|
// And make them local/first-touch biased.
|
||||||
os::numa_make_local((char*)aligned_region.start(), aligned_region.byte_size(), lgrp_id);
|
os::numa_make_local((char*)aligned_region.start(), aligned_region.byte_size(), lgrp_id);
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ void MutableNUMASpace::free_region(MemRegion mr) {
|
|||||||
assert((intptr_t)aligned_region.start() % page_size() == 0 &&
|
assert((intptr_t)aligned_region.start() % page_size() == 0 &&
|
||||||
(intptr_t)aligned_region.byte_size() % page_size() == 0, "Bad alignment");
|
(intptr_t)aligned_region.byte_size() % page_size() == 0, "Bad alignment");
|
||||||
assert(region().contains(aligned_region), "Sanity");
|
assert(region().contains(aligned_region), "Sanity");
|
||||||
os::free_memory((char*)aligned_region.start(), aligned_region.byte_size());
|
os::free_memory((char*)aligned_region.start(), aligned_region.byte_size(), page_size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ void MutableNUMASpace::LGRPSpace::scan_pages(size_t page_size, size_t page_count
|
|||||||
if (e != scan_end) {
|
if (e != scan_end) {
|
||||||
if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id())
|
if ((page_expected.size != page_size || page_expected.lgrp_id != lgrp_id())
|
||||||
&& page_expected.size != 0) {
|
&& page_expected.size != 0) {
|
||||||
os::free_memory(s, pointer_delta(e, s, sizeof(char)));
|
os::free_memory(s, pointer_delta(e, s, sizeof(char)), page_size);
|
||||||
}
|
}
|
||||||
page_expected = page_found;
|
page_expected = page_found;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ void MutableSpace::numa_setup_pages(MemRegion mr, bool clear_space) {
|
|||||||
size_t size = pointer_delta(end, start, sizeof(char));
|
size_t size = pointer_delta(end, start, sizeof(char));
|
||||||
if (clear_space) {
|
if (clear_space) {
|
||||||
// Prefer page reallocation to migration.
|
// Prefer page reallocation to migration.
|
||||||
os::free_memory((char*)start, size);
|
os::free_memory((char*)start, size, page_size);
|
||||||
}
|
}
|
||||||
os::numa_make_global((char*)start, size);
|
os::numa_make_global((char*)start, size);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ class os: AllStatic {
|
|||||||
char *addr, size_t bytes, bool read_only,
|
char *addr, size_t bytes, bool read_only,
|
||||||
bool allow_exec);
|
bool allow_exec);
|
||||||
static bool unmap_memory(char *addr, size_t bytes);
|
static bool unmap_memory(char *addr, size_t bytes);
|
||||||
static void free_memory(char *addr, size_t bytes);
|
static void free_memory(char *addr, size_t bytes, size_t alignment_hint);
|
||||||
static void realign_memory(char *addr, size_t bytes, size_t alignment_hint);
|
static void realign_memory(char *addr, size_t bytes, size_t alignment_hint);
|
||||||
|
|
||||||
// NUMA-specific interface
|
// NUMA-specific interface
|
||||||
|
Loading…
Reference in New Issue
Block a user