equal
deleted
inserted
replaced
32 #include "gc/z/zPageAllocator.hpp" |
32 #include "gc/z/zPageAllocator.hpp" |
33 #include "gc/z/zPageCache.inline.hpp" |
33 #include "gc/z/zPageCache.inline.hpp" |
34 #include "gc/z/zSafeDelete.inline.hpp" |
34 #include "gc/z/zSafeDelete.inline.hpp" |
35 #include "gc/z/zStat.hpp" |
35 #include "gc/z/zStat.hpp" |
36 #include "gc/z/zTracer.inline.hpp" |
36 #include "gc/z/zTracer.inline.hpp" |
|
37 #include "runtime/globals.hpp" |
37 #include "runtime/init.hpp" |
38 #include "runtime/init.hpp" |
38 #include "runtime/java.hpp" |
39 #include "runtime/java.hpp" |
39 #include "utilities/debug.hpp" |
40 #include "utilities/debug.hpp" |
40 |
41 |
41 static const ZStatCounter ZCounterAllocationRate("Memory", "Allocation Rate", ZStatUnitBytesPerSecond); |
42 static const ZStatCounter ZCounterAllocationRate("Memory", "Allocation Rate", ZStatUnitBytesPerSecond); |
91 ZPageAllocator::ZPageAllocator(size_t min_capacity, |
92 ZPageAllocator::ZPageAllocator(size_t min_capacity, |
92 size_t initial_capacity, |
93 size_t initial_capacity, |
93 size_t max_capacity, |
94 size_t max_capacity, |
94 size_t max_reserve) : |
95 size_t max_reserve) : |
95 _lock(), |
96 _lock(), |
96 _virtual(), |
97 _virtual(max_capacity), |
97 _physical(), |
98 _physical(), |
98 _cache(), |
99 _cache(), |
99 _min_capacity(min_capacity), |
100 _min_capacity(min_capacity), |
100 _max_capacity(max_capacity), |
101 _max_capacity(max_capacity), |
101 _max_reserve(max_reserve), |
102 _max_reserve(max_reserve), |
179 |
180 |
180 size_t ZPageAllocator::max_capacity() const { |
181 size_t ZPageAllocator::max_capacity() const { |
181 return _max_capacity; |
182 return _max_capacity; |
182 } |
183 } |
183 |
184 |
184 size_t ZPageAllocator::current_max_capacity() const { |
185 size_t ZPageAllocator::soft_max_capacity() const { |
185 return _current_max_capacity; |
186 // Note that SoftMaxHeapSize is a manageable flag |
|
187 return MIN2(SoftMaxHeapSize, _current_max_capacity); |
186 } |
188 } |
187 |
189 |
188 size_t ZPageAllocator::capacity() const { |
190 size_t ZPageAllocator::capacity() const { |
189 return _capacity; |
191 return _capacity; |
190 } |
192 } |
333 |
335 |
334 if (committed != commit) { |
336 if (committed != commit) { |
335 // Failed, or partly failed, to increase capacity. Adjust current |
337 // Failed, or partly failed, to increase capacity. Adjust current |
336 // max capacity to avoid further attempts to increase capacity. |
338 // max capacity to avoid further attempts to increase capacity. |
337 log_error(gc)("Forced to lower max Java heap size from " |
339 log_error(gc)("Forced to lower max Java heap size from " |
338 SIZE_FORMAT "M(%.0lf%%) to " SIZE_FORMAT "M(%.0lf%%)", |
340 SIZE_FORMAT "M(%.0f%%) to " SIZE_FORMAT "M(%.0f%%)", |
339 _current_max_capacity / M, percent_of(_current_max_capacity, _max_capacity), |
341 _current_max_capacity / M, percent_of(_current_max_capacity, _max_capacity), |
340 _capacity / M, percent_of(_capacity, _max_capacity)); |
342 _capacity / M, percent_of(_capacity, _max_capacity)); |
341 |
343 |
342 _current_max_capacity = _capacity; |
344 _current_max_capacity = _capacity; |
343 } |
345 } |
568 assert(requested == flushed, "Failed to flush"); |
570 assert(requested == flushed, "Failed to flush"); |
569 |
571 |
570 const size_t cached_after = _cache.available(); |
572 const size_t cached_after = _cache.available(); |
571 const size_t cached_before = cached_after + flushed; |
573 const size_t cached_before = cached_after + flushed; |
572 |
574 |
573 log_info(gc, heap)("Page Cache: " SIZE_FORMAT "M(%.0lf%%)->" SIZE_FORMAT "M(%.0lf%%), " |
575 log_info(gc, heap)("Page Cache: " SIZE_FORMAT "M(%.0f%%)->" SIZE_FORMAT "M(%.0f%%), " |
574 "Flushed: " SIZE_FORMAT "M", |
576 "Flushed: " SIZE_FORMAT "M", |
575 cached_before / M, percent_of(cached_before, max_capacity()), |
577 cached_before / M, percent_of(cached_before, max_capacity()), |
576 cached_after / M, percent_of(cached_after, max_capacity()), |
578 cached_after / M, percent_of(cached_after, max_capacity()), |
577 flushed / M); |
579 flushed / M); |
578 |
580 |
656 capacity_after = _capacity; |
658 capacity_after = _capacity; |
657 capacity_before = capacity_after + uncommitted; |
659 capacity_before = capacity_after + uncommitted; |
658 } |
660 } |
659 |
661 |
660 if (uncommitted > 0) { |
662 if (uncommitted > 0) { |
661 log_info(gc, heap)("Capacity: " SIZE_FORMAT "M(%.0lf%%)->" SIZE_FORMAT "M(%.0lf%%), " |
663 log_info(gc, heap)("Capacity: " SIZE_FORMAT "M(%.0f%%)->" SIZE_FORMAT "M(%.0f%%), " |
662 "Uncommitted: " SIZE_FORMAT "M", |
664 "Uncommitted: " SIZE_FORMAT "M", |
663 capacity_before / M, percent_of(capacity_before, max_capacity()), |
665 capacity_before / M, percent_of(capacity_before, max_capacity()), |
664 capacity_after / M, percent_of(capacity_after, max_capacity()), |
666 capacity_after / M, percent_of(capacity_after, max_capacity()), |
665 uncommitted / M); |
667 uncommitted / M); |
666 |
668 |