mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 11:34:38 +02:00
8022880: False sharing between PSPromotionManager instances
Pad the PSPromotionManager instances in the manager array. Reviewed-by: brutisso, jmasa
This commit is contained in:
parent
7cea3820af
commit
70f22c649b
10 changed files with 189 additions and 47 deletions
|
@ -50,6 +50,7 @@
|
|||
#include "memory/genMarkSweep.hpp"
|
||||
#include "memory/genOopClosures.inline.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
#include "memory/referencePolicy.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/tenuredGeneration.hpp"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
|
||||
#include "gc_implementation/shared/copyFailedInfo.hpp"
|
||||
#include "memory/defNewGeneration.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
#include "utilities/taskqueue.hpp"
|
||||
|
||||
class ChunkArray;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -26,6 +26,7 @@
|
|||
#define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_HPP
|
||||
|
||||
#include "memory/genOopClosures.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
|
||||
// Closures for ParNewGeneration
|
||||
|
||||
|
|
|
@ -29,14 +29,16 @@
|
|||
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
||||
#include "gc_implementation/shared/gcTrace.hpp"
|
||||
#include "gc_implementation/shared/mutableSpace.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
#include "memory/memRegion.hpp"
|
||||
#include "memory/padded.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/oop.psgc.inline.hpp"
|
||||
|
||||
PSPromotionManager** PSPromotionManager::_manager_array = NULL;
|
||||
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL;
|
||||
PSOldGen* PSPromotionManager::_old_gen = NULL;
|
||||
MutableSpace* PSPromotionManager::_young_space = NULL;
|
||||
PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
|
||||
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL;
|
||||
PSOldGen* PSPromotionManager::_old_gen = NULL;
|
||||
MutableSpace* PSPromotionManager::_young_space = NULL;
|
||||
|
||||
void PSPromotionManager::initialize() {
|
||||
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
|
||||
|
@ -45,8 +47,10 @@ void PSPromotionManager::initialize() {
|
|||
_old_gen = heap->old_gen();
|
||||
_young_space = heap->young_gen()->to_space();
|
||||
|
||||
// To prevent false sharing, we pad the PSPromotionManagers
|
||||
// and make sure that the first instance starts at a cache line.
|
||||
assert(_manager_array == NULL, "Attempt to initialize twice");
|
||||
_manager_array = NEW_C_HEAP_ARRAY(PSPromotionManager*, ParallelGCThreads+1, mtGC);
|
||||
_manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(ParallelGCThreads + 1);
|
||||
guarantee(_manager_array != NULL, "Could not initialize promotion manager");
|
||||
|
||||
_stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads);
|
||||
|
@ -54,26 +58,21 @@ void PSPromotionManager::initialize() {
|
|||
|
||||
// Create and register the PSPromotionManager(s) for the worker threads.
|
||||
for(uint i=0; i<ParallelGCThreads; i++) {
|
||||
_manager_array[i] = new PSPromotionManager();
|
||||
guarantee(_manager_array[i] != NULL, "Could not create PSPromotionManager");
|
||||
stack_array_depth()->register_queue(i, _manager_array[i]->claimed_stack_depth());
|
||||
stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth());
|
||||
}
|
||||
|
||||
// The VMThread gets its own PSPromotionManager, which is not available
|
||||
// for work stealing.
|
||||
_manager_array[ParallelGCThreads] = new PSPromotionManager();
|
||||
guarantee(_manager_array[ParallelGCThreads] != NULL, "Could not create PSPromotionManager");
|
||||
}
|
||||
|
||||
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
|
||||
assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
|
||||
assert(_manager_array != NULL, "Sanity");
|
||||
return _manager_array[index];
|
||||
return &_manager_array[index];
|
||||
}
|
||||
|
||||
PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() {
|
||||
assert(_manager_array != NULL, "Sanity");
|
||||
return _manager_array[ParallelGCThreads];
|
||||
return &_manager_array[ParallelGCThreads];
|
||||
}
|
||||
|
||||
void PSPromotionManager::pre_scavenge() {
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "gc_implementation/shared/gcTrace.hpp"
|
||||
#include "gc_implementation/shared/copyFailedInfo.hpp"
|
||||
#include "memory/allocation.hpp"
|
||||
#include "memory/padded.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#include "utilities/taskqueue.hpp"
|
||||
|
||||
//
|
||||
|
@ -51,14 +53,14 @@ class MutableSpace;
|
|||
class PSOldGen;
|
||||
class ParCompactionManager;
|
||||
|
||||
class PSPromotionManager : public CHeapObj<mtGC> {
|
||||
class PSPromotionManager VALUE_OBJ_CLASS_SPEC {
|
||||
friend class PSScavenge;
|
||||
friend class PSRefProcTaskExecutor;
|
||||
private:
|
||||
static PSPromotionManager** _manager_array;
|
||||
static OopStarTaskQueueSet* _stack_array_depth;
|
||||
static PSOldGen* _old_gen;
|
||||
static MutableSpace* _young_space;
|
||||
static PaddedEnd<PSPromotionManager>* _manager_array;
|
||||
static OopStarTaskQueueSet* _stack_array_depth;
|
||||
static PSOldGen* _old_gen;
|
||||
static MutableSpace* _young_space;
|
||||
|
||||
#if TASKQUEUE_STATS
|
||||
size_t _masked_pushes;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
|
||||
assert(_manager_array != NULL, "access of NULL manager_array");
|
||||
assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
|
||||
return _manager_array[index];
|
||||
return &_manager_array[index];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue