mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-19 23:05:28 +00:00
8345970: pthread_getcpuclockid related crashes in shenandoah tests
Reviewed-by: shade Backport-of: 2ce53e88481659734bc5424c643c5e31c116bc5d
This commit is contained in:
parent
33971ecb6e
commit
cc7c293bce
@ -180,8 +180,8 @@ void ShenandoahGenerationalHeap::gc_threads_do(ThreadClosure* tcl) const {
|
||||
}
|
||||
|
||||
void ShenandoahGenerationalHeap::stop() {
|
||||
regulator_thread()->stop();
|
||||
ShenandoahHeap::stop();
|
||||
regulator_thread()->stop();
|
||||
}
|
||||
|
||||
void ShenandoahGenerationalHeap::evacuate_collection_set(bool concurrent) {
|
||||
|
||||
@ -538,7 +538,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
|
||||
_pacer(nullptr),
|
||||
_verifier(nullptr),
|
||||
_phase_timings(nullptr),
|
||||
_mmu_tracker(),
|
||||
_monitoring_support(nullptr),
|
||||
_memory_pool(nullptr),
|
||||
_stw_memory_manager("Shenandoah Pauses"),
|
||||
@ -632,6 +631,8 @@ public:
|
||||
|
||||
void ShenandoahHeap::post_initialize() {
|
||||
CollectedHeap::post_initialize();
|
||||
|
||||
// Schedule periodic task to report on gc thread CPU utilization
|
||||
_mmu_tracker.initialize();
|
||||
|
||||
MutexLocker ml(Threads_lock);
|
||||
@ -2084,6 +2085,9 @@ void ShenandoahHeap::stop() {
|
||||
// Step 0. Notify policy to disable event recording and prevent visiting gc threads during shutdown
|
||||
_shenandoah_policy->record_shutdown();
|
||||
|
||||
// Step 0a. Stop reporting on gc thread cpu utilization
|
||||
mmu_tracker()->stop();
|
||||
|
||||
// Step 1. Notify control thread that we are in shutdown.
|
||||
// Note that we cannot do that with stop(), because stop() is blocking and waits for the actual shutdown.
|
||||
// Doing stop() here would wait for the normal GC cycle to complete, never falling through to cancel below.
|
||||
|
||||
@ -48,6 +48,7 @@ class ThreadTimeAccumulator : public ThreadClosure {
|
||||
size_t total_time;
|
||||
ThreadTimeAccumulator() : total_time(0) {}
|
||||
void do_thread(Thread* thread) override {
|
||||
assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: " UINTX_FORMAT, thread->osthread()->thread_id_for_printing());
|
||||
total_time += os::thread_cpu_time(thread);
|
||||
}
|
||||
};
|
||||
@ -65,7 +66,6 @@ ShenandoahMmuTracker::ShenandoahMmuTracker() :
|
||||
}
|
||||
|
||||
ShenandoahMmuTracker::~ShenandoahMmuTracker() {
|
||||
_mmu_periodic_task->disenroll();
|
||||
delete _mmu_periodic_task;
|
||||
}
|
||||
|
||||
@ -175,6 +175,10 @@ void ShenandoahMmuTracker::report() {
|
||||
log_debug(gc)("Periodic Sample: GCU = %.3f%%, MU = %.3f%% during most recent %.1fs", gcu * 100, mu * 100, time_delta);
|
||||
}
|
||||
|
||||
void ShenandoahMmuTracker::stop() const {
|
||||
_mmu_periodic_task->disenroll();
|
||||
}
|
||||
|
||||
void ShenandoahMmuTracker::initialize() {
|
||||
// initialize static data
|
||||
_active_processors = os::initial_active_processor_count();
|
||||
|
||||
@ -101,6 +101,10 @@ public:
|
||||
// GCPauseIntervalMillis and defaults to 5 seconds. This method computes
|
||||
// the MMU over the elapsed interval and records it in a running average.
|
||||
void report();
|
||||
|
||||
// Unenrolls the periodic task that collects CPU utilization for GC threads. This must happen _before_ the
|
||||
// gc threads are stopped and terminated.
|
||||
void stop() const;
|
||||
};
|
||||
|
||||
#endif //SHARE_GC_SHENANDOAH_SHENANDOAHMMUTRACKER_HPP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user