--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp Wed Sep 24 15:34:06 2008 -0400
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp Sat Sep 27 00:33:13 2008 -0700
@@ -60,6 +60,7 @@
MutableSpace* _space;
MemRegion _invalid_region;
AdaptiveWeightedAverage *_alloc_rate;
+ bool _allocation_failed;
struct SpaceStats {
size_t _local_space, _remote_space, _unbiased_space, _uncommited_space;
@@ -81,7 +82,7 @@
char* last_page_scanned() { return _last_page_scanned; }
void set_last_page_scanned(char* p) { _last_page_scanned = p; }
public:
- LGRPSpace(int l) : _lgrp_id(l), _last_page_scanned(NULL) {
+ LGRPSpace(int l) : _lgrp_id(l), _last_page_scanned(NULL), _allocation_failed(false) {
_space = new MutableSpace();
_alloc_rate = new AdaptiveWeightedAverage(NUMAChunkResizeWeight);
}
@@ -103,8 +104,21 @@
return *(int*)lgrp_id_value == p->lgrp_id();
}
+ // Report a failed allocation.
+ void set_allocation_failed() { _allocation_failed = true; }
+
void sample() {
- alloc_rate()->sample(space()->used_in_bytes());
+ // If there was a failed allocation make allocation rate equal
+ // to the size of the whole chunk. This ensures the progress of
+ // the adaptation process.
+ size_t alloc_rate_sample;
+ if (_allocation_failed) {
+ alloc_rate_sample = space()->capacity_in_bytes();
+ _allocation_failed = false;
+ } else {
+ alloc_rate_sample = space()->used_in_bytes();
+ }
+ alloc_rate()->sample(alloc_rate_sample);
}
MemRegion invalid_region() const { return _invalid_region; }
@@ -190,6 +204,9 @@
virtual void ensure_parsability();
virtual size_t used_in_words() const;
virtual size_t free_in_words() const;
+
+ using MutableSpace::capacity_in_words;
+ virtual size_t capacity_in_words(Thread* thr) const;
virtual size_t tlab_capacity(Thread* thr) const;
virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;