src/hotspot/share/gc/g1/collectionSetChooser.hpp
author tschatzl
Fri, 08 Feb 2019 12:55:20 +0100
changeset 53703 24341625d8f2
parent 53244 9807daeb47c4
permissions -rw-r--r--
8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm Reviewed-by: lkorinth, kbarrett
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
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49607
diff changeset
     2
 * Copyright (c) 2001, 2019, 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: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
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: 2105
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49607
diff changeset
    25
#ifndef SHARE_GC_G1_COLLECTIONSETCHOOSER_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49607
diff changeset
    26
#define SHARE_GC_G1_COLLECTIONSETCHOOSER_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    28
#include "gc/g1/heapRegion.hpp"
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    29
#include "memory/allocation.hpp"
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    30
#include "runtime/globals.hpp"
12382
6aaecb1cbfe1 7145441: G1: collection set chooser-related cleanup
tonyp
parents: 12381
diff changeset
    31
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    32
class G1CollectionSetCandidates;
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    33
class WorkGang;
11756
28b6fe22e43d 7132029: G1: mixed GC phase lasts for longer than it should
tonyp
parents: 10680
diff changeset
    34
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    35
// Helper class to calculate collection set candidates, and containing some related
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    36
// methods.
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    37
class CollectionSetChooser : public AllStatic {
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    38
  static uint calculate_work_chunk_size(uint num_workers, uint num_regions);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    39
public:
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    40
49605
784f3f2dea14 8197570: Make rules for choosing collection set candidates more explicit
tschatzl
parents: 47216
diff changeset
    41
  static size_t mixed_gc_live_threshold_bytes() {
784f3f2dea14 8197570: Make rules for choosing collection set candidates more explicit
tschatzl
parents: 47216
diff changeset
    42
    return HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
784f3f2dea14 8197570: Make rules for choosing collection set candidates more explicit
tschatzl
parents: 47216
diff changeset
    43
  }
784f3f2dea14 8197570: Make rules for choosing collection set candidates more explicit
tschatzl
parents: 47216
diff changeset
    44
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    45
  static bool region_occupancy_low_enough_for_evac(size_t live_bytes) {
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    46
    return live_bytes < mixed_gc_live_threshold_bytes();
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    47
  }
49605
784f3f2dea14 8197570: Make rules for choosing collection set candidates more explicit
tschatzl
parents: 47216
diff changeset
    48
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    49
  // Determine whether to add the given region to the collection set candidates or
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30874
diff changeset
    50
  // not. Currently, we skip pinned regions and regions whose live
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30874
diff changeset
    51
  // bytes are over the threshold. Humongous regions may be reclaimed during cleanup.
49607
acffe6ff3ae7 8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents: 49605
diff changeset
    52
  // Regions also need a complete remembered set to be a candidate.
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    53
  static bool should_add(HeapRegion* hr);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    54
53703
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    55
  // Build and return set of collection set candidates sorted by decreasing gc
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    56
  // efficiency.
24341625d8f2 8217330: Split G1CollectionSetChooser into collection set candidate container and the chooser algorithm
tschatzl
parents: 53244
diff changeset
    57
  static G1CollectionSetCandidates* build(WorkGang* workers, uint max_num_regions);
13336
e582172ff6ff 7114678: G1: various small fixes, code cleanup, and refactoring
tonyp
parents: 13195
diff changeset
    58
};
e582172ff6ff 7114678: G1: various small fixes, code cleanup, and refactoring
tonyp
parents: 13195
diff changeset
    59
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 49607
diff changeset
    60
#endif // SHARE_GC_G1_COLLECTIONSETCHOOSER_HPP