8203457: Add back missing full buffer notification

Reviewed-by: redestad, sjohanss
This commit is contained in:
Markus Grönlund 2018-05-23 15:21:54 +02:00
parent 6c2e9e1981
commit ae106e353a
2 changed files with 13 additions and 6 deletions

View File

@ -332,6 +332,7 @@ static bool full_buffer_registration(BufferPtr buffer, JfrStorageAgeMspace* age_
assert(age_node->acquired_by_self(), "invariant");
assert(age_node != NULL, "invariant");
age_node->set_retired_buffer(buffer);
control.increment_full();
return insert_full_age_node(age_node, age_mspace, thread);
}
@ -631,6 +632,7 @@ template <typename Processor>
static void process_age_list(Processor& processor, JfrStorageAgeMspace* age_mspace, JfrAgeNode* head, size_t count) {
assert(age_mspace != NULL, "invariant");
assert(head != NULL, "invariant");
assert(count > 0, "invariant");
JfrAgeNode* node = head;
JfrAgeNode* last = NULL;
while (node != NULL) {
@ -669,7 +671,7 @@ static size_t process_full(Processor& processor, JfrStorageControl& control, Jfr
return 0;
}
size_t count;
JfrAgeNode* head;;
JfrAgeNode* head;
{
// fetch age list
MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
@ -678,6 +680,7 @@ static size_t process_full(Processor& processor, JfrStorageControl& control, Jfr
control.reset_full();
}
assert(head != NULL, "invariant");
assert(count > 0, "invariant");
process_age_list(processor, age_mspace, head, count);
return count;
}

View File

@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "jfr/recorder/storage/jfrStorageControl.hpp"
#include "runtime/atomic.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/orderAccess.inline.hpp"
// returns the updated value
@ -69,22 +70,25 @@ void JfrStorageControl::set_to_disk(bool enable) {
_to_disk = enable;
}
// concurrent with lax requirement
size_t JfrStorageControl::full_count() const {
return _full_count;
}
// mutexed access
size_t JfrStorageControl::increment_full() {
return atomic_add(1, &_full_count);
assert(JfrBuffer_lock->owned_by_self(), "invariant");
return ++_full_count;
}
size_t JfrStorageControl::decrement_full() {
return atomic_dec(&_full_count);
assert(JfrBuffer_lock->owned_by_self(), "invariant");
assert(_full_count > 0, "invariant");
return --_full_count;
}
void JfrStorageControl::reset_full() {
Atomic::store((size_t)0, &_full_count);
assert(JfrBuffer_lock->owned_by_self(), "invariant");
_full_count = 0;
}
bool JfrStorageControl::should_post_buffer_full_message() const {