Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8260332: ParallelGC: Cooperative pretouch for oldgen expansion #2976

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -31,6 +31,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/osThread.hpp"
#include "runtime/thread.hpp"
#include "utilities/align.hpp"
#include "utilities/macros.hpp"
@@ -196,7 +196,7 @@ bool PSOldGen::expand_for_allocate(size_t word_size) {
{
bool is_locked = false;
while(true) {
MutexLocker x(ExpandHeap_lock, is_locked);
is_locked = ExpandHeap_lock->try_lock();
// Avoid "expand storms" by rechecking available space after obtaining
// the lock, because another thread may have already made sufficient
// space available. If insufficient space available, that will remain
@@ -216,6 +216,7 @@ bool PSOldGen::expand_for_allocate(size_t word_size) {
}

assert (pretouch()->is_task_done(), "Task should be done at this point");
ExpandHeap_lock->unlock();
break;

} else {
@@ -35,7 +35,7 @@ PretouchTask::PretouchTask(const char* task_name,
char* end_address,
size_t page_size,
size_t chunk_size,
size_t n_threads,
uint n_threads,
size_t task_status) :
AbstractGangTask(task_name),
_cur_addr(start_address),
@@ -39,7 +39,7 @@ class PretouchTask : public AbstractGangTask {
volatile size_t _task_status;

public:
PretouchTask(const char* task_name, char* start_address, char* end_address, size_t page_size, size_t chunk_size, size_t n_threads = 0, size_t task_status = Ready);
PretouchTask(const char* task_name, char* start_address, char* end_address, size_t page_size, size_t chunk_size, uint n_threads = 0, size_t task_status = Ready);

void reinitialize(char* start_address, char *end_addr);

@@ -228,23 +228,6 @@ class MutexLocker: public StackObj {
}
}

MutexLocker(Mutex* mutex, bool& lock_acquired, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
_mutex(mutex) {
bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
if (_mutex != NULL) {
assert(_mutex->rank() > Mutex::special || no_safepoint_check,
"Mutexes with rank special or lower should not do safepoint checks");
if (!no_safepoint_check) {
lock_acquired = _mutex->try_lock();
}

if (!lock_acquired) {
_mutex = NULL;
}
}
}


~MutexLocker() {
if (_mutex != NULL) {
assert_lock_strong(_mutex);
ProTip! Use n and p to navigate between commits in a pull request.