mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 18:44:38 +02:00
8157952: Parallelize Memory Pretouch
Use multiple threads to pretouch memory using -XX:+AlwaysPreTouch to use more memory bandwidth Reviewed-by: jmasa, sangheki
This commit is contained in:
parent
b77d0de3d9
commit
317f1aa044
12 changed files with 124 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -72,22 +72,22 @@ HeapRegion* HeapRegionManager::new_heap_region(uint hrm_index) {
|
|||
return g1h->new_heap_region(hrm_index, mr);
|
||||
}
|
||||
|
||||
void HeapRegionManager::commit_regions(uint index, size_t num_regions) {
|
||||
void HeapRegionManager::commit_regions(uint index, size_t num_regions, WorkGang* pretouch_gang) {
|
||||
guarantee(num_regions > 0, "Must commit more than zero regions");
|
||||
guarantee(_num_committed + num_regions <= max_length(), "Cannot commit more than the maximum amount of regions");
|
||||
|
||||
_num_committed += (uint)num_regions;
|
||||
|
||||
_heap_mapper->commit_regions(index, num_regions);
|
||||
_heap_mapper->commit_regions(index, num_regions, pretouch_gang);
|
||||
|
||||
// Also commit auxiliary data
|
||||
_prev_bitmap_mapper->commit_regions(index, num_regions);
|
||||
_next_bitmap_mapper->commit_regions(index, num_regions);
|
||||
_prev_bitmap_mapper->commit_regions(index, num_regions, pretouch_gang);
|
||||
_next_bitmap_mapper->commit_regions(index, num_regions, pretouch_gang);
|
||||
|
||||
_bot_mapper->commit_regions(index, num_regions);
|
||||
_cardtable_mapper->commit_regions(index, num_regions);
|
||||
_bot_mapper->commit_regions(index, num_regions, pretouch_gang);
|
||||
_cardtable_mapper->commit_regions(index, num_regions, pretouch_gang);
|
||||
|
||||
_card_counts_mapper->commit_regions(index, num_regions);
|
||||
_card_counts_mapper->commit_regions(index, num_regions, pretouch_gang);
|
||||
}
|
||||
|
||||
void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) {
|
||||
|
@ -117,9 +117,9 @@ void HeapRegionManager::uncommit_regions(uint start, size_t num_regions) {
|
|||
_card_counts_mapper->uncommit_regions(start, num_regions);
|
||||
}
|
||||
|
||||
void HeapRegionManager::make_regions_available(uint start, uint num_regions) {
|
||||
void HeapRegionManager::make_regions_available(uint start, uint num_regions, WorkGang* pretouch_gang) {
|
||||
guarantee(num_regions > 0, "No point in calling this for zero regions");
|
||||
commit_regions(start, num_regions);
|
||||
commit_regions(start, num_regions, pretouch_gang);
|
||||
for (uint i = start; i < start + num_regions; i++) {
|
||||
if (_regions.get_by_index(i) == NULL) {
|
||||
HeapRegion* new_hr = new_heap_region(i);
|
||||
|
@ -163,11 +163,11 @@ MemoryUsage HeapRegionManager::get_auxiliary_data_memory_usage() const {
|
|||
return MemoryUsage(0, used_sz, committed_sz, committed_sz);
|
||||
}
|
||||
|
||||
uint HeapRegionManager::expand_by(uint num_regions) {
|
||||
return expand_at(0, num_regions);
|
||||
uint HeapRegionManager::expand_by(uint num_regions, WorkGang* pretouch_workers) {
|
||||
return expand_at(0, num_regions, pretouch_workers);
|
||||
}
|
||||
|
||||
uint HeapRegionManager::expand_at(uint start, uint num_regions) {
|
||||
uint HeapRegionManager::expand_at(uint start, uint num_regions, WorkGang* pretouch_workers) {
|
||||
if (num_regions == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ uint HeapRegionManager::expand_at(uint start, uint num_regions) {
|
|||
while (expanded < num_regions &&
|
||||
(num_last_found = find_unavailable_from_idx(cur, &idx_last_found)) > 0) {
|
||||
uint to_expand = MIN2(num_regions - expanded, num_last_found);
|
||||
make_regions_available(idx_last_found, to_expand);
|
||||
make_regions_available(idx_last_found, to_expand, pretouch_workers);
|
||||
expanded += to_expand;
|
||||
cur = idx_last_found + num_last_found + 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue