hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp
author jprovino
Tue, 02 Aug 2016 16:39:33 -0400
changeset 40328 a2851f5f1cf6
parent 38172 90f405aac699
child 46653 d72083d17b19
permissions -rw-r--r--
8071770: G1 does not implement millis_since_last_gc which is needed by RMI GC Summary: G1 does not return a correct value for the CollectedHeap::millis_since_last_gc Reviewed-by: jmasa, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     1
/*
36371
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
     2
 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     4
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     8
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    13
 * accompanied this code).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    14
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5033
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5033
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5033
diff changeset
    21
 * questions.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    22
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    23
 */
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26160
diff changeset
    25
#ifndef SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26160
diff changeset
    26
#define SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6247
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6247
diff changeset
    28
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6247
diff changeset
    29
#include "utilities/globalDefinitions.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6247
diff changeset
    30
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    31
// Forward decl
38172
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 37510
diff changeset
    32
class CardTableEntryClosure;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    33
class ConcurrentG1RefineThread;
38172
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 37510
diff changeset
    34
class G1YoungRemSetSamplingThread;
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 37510
diff changeset
    35
class outputStream;
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 37510
diff changeset
    36
class ThreadClosure;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    37
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 9185
diff changeset
    38
class ConcurrentG1Refine: public CHeapObj<mtGC> {
33608
7afc768e4d62 8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents: 33204
diff changeset
    39
  G1YoungRemSetSamplingThread* _sample_thread;
7afc768e4d62 8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents: 33204
diff changeset
    40
2881
74a1337e4acc 6484957: G1: parallel concurrent refinement
iveresov
parents: 2105
diff changeset
    41
  ConcurrentG1RefineThread** _threads;
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 17854
diff changeset
    42
  uint _n_worker_threads;
4481
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    43
 /*
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    44
  * The value of the update buffer queue length falls into one of 3 zones:
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    45
  * green, yellow, red. If the value is in [0, green) nothing is
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    46
  * done, the buffers are left unprocessed to enable the caching effect of the
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    47
  * dirtied cards. In the yellow zone [green, yellow) the concurrent refinement
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    48
  * threads are gradually activated. In [yellow, red) all threads are
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    49
  * running. If the length becomes red (max queue length) the mutators start
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    50
  * processing the buffers.
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    51
  *
5033
55f476a32544 6928059: G1: command line parameter renaming
tonyp
parents: 4481
diff changeset
    52
  * There are some interesting cases (when G1UseAdaptiveConcRefinement
55f476a32544 6928059: G1: command line parameter renaming
tonyp
parents: 4481
diff changeset
    53
  * is turned off):
4481
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    54
  * 1) green = yellow = red = 0. In this case the mutator will process all
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    55
  *    buffers. Except for those that are created by the deferred updates
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    56
  *    machinery during a collection.
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    57
  * 2) green = 0. Means no caching. Can be a good way to minimize the
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    58
  *    amount of time spent updating rsets during a collection.
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    59
  */
36371
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
    60
  size_t _green_zone;
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
    61
  size_t _yellow_zone;
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
    62
  size_t _red_zone;
37510
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    63
  size_t _min_yellow_zone_size;
37158
b882bbfa1af0 8152101: Move G1 concurrent refinement adjustment code out of G1CollectorPolicy
mgerdin
parents: 36371
diff changeset
    64
38172
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 37510
diff changeset
    65
  ConcurrentG1Refine(size_t green_zone,
37510
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    66
                     size_t yellow_zone,
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    67
                     size_t red_zone,
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    68
                     size_t min_yellow_zone_size);
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3589
diff changeset
    69
37510
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    70
  // Update green/yellow/red zone values based on how well goals are being met.
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    71
  void update_zones(double update_rs_time,
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    72
                    size_t update_rs_processed_buffers,
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    73
                    double goal_ms);
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    74
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    75
  // Update thread thresholds to account for updated zone values.
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    76
  void update_thread_thresholds();
32738
a1adf25202fd 8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents: 30764
diff changeset
    77
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    78
 public:
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    79
  ~ConcurrentG1Refine();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    80
32738
a1adf25202fd 8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents: 30764
diff changeset
    81
  // Returns ConcurrentG1Refine instance if succeeded to create/initialize ConcurrentG1Refine and ConcurrentG1RefineThread.
a1adf25202fd 8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents: 30764
diff changeset
    82
  // Otherwise, returns NULL with error code.
38172
90f405aac699 8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents: 37510
diff changeset
    83
  static ConcurrentG1Refine* create(CardTableEntryClosure* refine_closure, jint* ecode);
32738
a1adf25202fd 8135025: Error message is repeated for large value at G1ConcRefinementThreads
sangheki
parents: 30764
diff changeset
    84
2881
74a1337e4acc 6484957: G1: parallel concurrent refinement
iveresov
parents: 2105
diff changeset
    85
  void stop();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    86
37510
cf066fe4531b 8133051: Concurrent refinement threads may be activated and deactivated at random
kbarrett
parents: 37158
diff changeset
    87
  void adjust(double update_rs_time, size_t update_rs_processed_buffers, double goal_ms);
4481
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
    88
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
    89
  // Iterate over all concurrent refinement threads
2881
74a1337e4acc 6484957: G1: parallel concurrent refinement
iveresov
parents: 2105
diff changeset
    90
  void threads_do(ThreadClosure *tc);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    91
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
    92
  // Iterate over all worker refinement threads
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
    93
  void worker_threads_do(ThreadClosure * tc);
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
    94
33608
7afc768e4d62 8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents: 33204
diff changeset
    95
  // The RS sampling thread has nothing to do with refinement, but is here for now.
7afc768e4d62 8138920: Refactor the sampling thread from ConcurrentG1RefineThread
drwhite
parents: 33204
diff changeset
    96
  G1YoungRemSetSamplingThread * sampling_thread() const { return _sample_thread; }
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
    97
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 17854
diff changeset
    98
  static uint thread_num();
4022
2ec87d5043f7 6885041: G1: inconsistent thread dump
tonyp
parents: 3590
diff changeset
    99
2ec87d5043f7 6885041: G1: inconsistent thread dump
tonyp
parents: 3590
diff changeset
   100
  void print_worker_threads_on(outputStream* st) const;
4481
de92ec484f5e 6862387: tune concurrent refinement further
iveresov
parents: 4022
diff changeset
   101
36371
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
   102
  size_t green_zone() const      { return _green_zone;  }
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
   103
  size_t yellow_zone() const     { return _yellow_zone; }
fd81a4f0ea00 8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents: 33608
diff changeset
   104
  size_t red_zone() const        { return _red_zone;    }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   105
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6247
diff changeset
   106
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26160
diff changeset
   107
#endif // SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP